Search code examples
macossalt-project

Removing Saltstack from Mac OSX


I don't remember how I installed saltstack on my mac, so I tried uninstalling it every way possible. I tried brew uninstall saltstack, pip uninstall salt. I attempted to see if salt -h had anything to say to uninstall it, but it didn't work.

Update some system outputs ➤ pip list | grep salt ➤ whereis salt-call ➤ which salt-call /opt/salt/bin/salt-call ➤ ls -l /opt/salt total 0 drwxr-xr-x 45 root wheel 1.5K 24 Aug 13:07 bin/ drwxr-xr-x 8 root wheel 272B 24 Aug 13:07 include/ drwxr-xr-x 14 root wheel 476B 24 Aug 13:07 lib/ drwxr-xr-x 8 root wheel 272B 24 Aug 13:07 openssl/ drwxr-xr-x 3 root wheel 102B 24 Aug 13:07 share/

I'm guessing I installed it from this link:

curl -L https://bootstrap.saltstack.com -o install_salt.sh sudo sh install_salt.sh -P -M but it doesn't say how to uninstall it based on this method. Anyone know?


Solution

  • /opt/salt/bin/salt-call

    It looks like you installed it using .pkg file: https://repo.saltstack.com/osx/

    You can verify by running some commands:

    ❯❯❯❯ pkgutil --pkgs | grep salt
    com.saltstack.salt
    
    ❯❯❯❯ pkgutil --pkg-info com.saltstack.salt
    package-id: com.saltstack.salt
    version: 2016.11.3
    volume: /
    location: /
    install-time: 1504874150
    

    List installed files:

    ❯❯❯❯ pkgutil --files com.saltstack.salt
    Library
    Library/LaunchDaemons
    Library/LaunchDaemons/com.saltstack.salt.api.plist
    Library/LaunchDaemons/com.saltstack.salt.master.plist
    Library/LaunchDaemons/com.saltstack.salt.minion.plist
    Library/LaunchDaemons/com.saltstack.salt.syndic.plist
    etc
    etc/salt
    etc/salt/master.dist
    etc/salt/minion.dist
    opt
    opt/salt
    opt/salt/bin
    ...
    

    Stop services:

    ❯❯❯❯ sudo launchctl unload -w /Library/LaunchDaemons/com.saltstack.salt.minion.plist
    

    Do the same for api, master, syndic if they are running.

    Make sure you're in the root directory:

    ❯❯❯❯ cd /
    

    Remove files first:

    ❯❯❯❯ pkgutil --only-files --files com.saltstack.salt | grep -v opt
    Library/LaunchDaemons/com.saltstack.salt.api.plist
    Library/LaunchDaemons/com.saltstack.salt.master.plist
    Library/LaunchDaemons/com.saltstack.salt.minion.plist
    Library/LaunchDaemons/com.saltstack.salt.syndic.plist
    etc/salt/master.dist
    etc/salt/minion.dist
    
    ❯❯❯❯ pkgutil --only-files --files com.saltstack.salt | grep -v opt | tr '\n' '\0' | xargs -0 sudo rm -f
    

    then directories:

    ❯❯❯❯ pkgutil --only-dirs --files com.saltstack.salt | grep -v opt
    Library
    Library/LaunchDaemons
    etc
    etc/salt
    
    ❯❯❯❯ sudo rm -fr etc/salt
    
    ❯❯❯❯ sudo rm -fr opt/salt
    

    And finally, remove the receipt:

    ❯❯❯❯ sudo pkgutil --forget com.saltstack.salt
    Forgot package 'com.saltstack.salt' on '/'.