Skip to content

Instantly share code, notes, and snippets.

@sappharx
Last active April 25, 2018 02:39
Show Gist options
  • Save sappharx/25836ca7b6d5daa954a113eb4bdc883f to your computer and use it in GitHub Desktop.
Save sappharx/25836ca7b6d5daa954a113eb4bdc883f to your computer and use it in GitHub Desktop.
mac set up scripts
#!/usr/bin/env bash -e
# download disk image
cd ~/Downloads
curl -O https://download.docker.com/mac/stable/Docker.dmg
# attach disk image
hdiutil attach Docker.dmg
# copy app folder to Applications directory
cp -R /Volumes/Docker/Docker.app /Applications/Docker.app
# detach disk image volume
hdiutil detach /Volumes/Docker
# delete disk image
rm Docker.dmg
# move pwd back to where it was
cd -
# open app
open -a Docker.app
#!/usr/bin/env bash -e
# download disk image
cd ~/Downloads
curl 'https://download.mozilla.org/?product=firefox-latest-ssl&os=osx&lang=en-US' | egrep -o 'https.*dmg' | xargs curl -o Firefox.dmg &
wait
# attach disk image
hdiutil attach Firefox.dmg
# copy app folder to Applications directory
cp -R /Volumes/Firefox/Firefox.app /Applications/Firefox.app
# detach disk image volume
hdiutil detach /Volumes/Firefox
# delete disk image
rm Firefox.dmg
# move pwd back to where it was
cd -
# would be nice to have the option to restore profile data from a backup
# open app (probably don't need to do this for firefox
open -a Firefox.app
#!/usr/bin/env bash -e
# download disk image
cd ~/Downloads
curl -o iTerm2.zip 'https://iterm2.com/downloads/stable/latest' &
wait
# unzip package
unzip iTerm2.zip
# move app folder to Applications directory
mv iTerm.app /Applications
# delete zip file
rm iTerm2.zip
# move pwd back to where it was
cd -
# would be nice to have the option to restore profile data from a backup
#!/usr/bin/env bash -e
# based off of https://github.com/docker/toolbox/blob/master/osx/uninstall.sh
# I don't know if the user HAS to be root to perform all the operations, but probably at least needs to be a sudoer
#if [ "${USER}" != "root" ]; then
# echo "$0 must be run as root!"
# exit 2
#fi
echo "Removing Applications..."
rm -rf /Applications/Docker.app
echo "Removing docker binaries..."
ls -l /usr/local/bin | grep '/Applications/Docker.app' | awk '{ print $9 }' | xargs -I % rm -f '/usr/local/bin/%'
echo "All Done!"
#!/usr/bin/env bash -e
# remove application
rm -rf /Applications/Firefox.app
# optionally, remove profile data
# probably want to prompt before removing
# would also be nice to allow backing up of profile data (and restoring in the install script)
# rm -rf "$HOME/Library/Application Support/Firefox" # there's also a Mozilla folder in there that may need to be deleted
#!/usr/bin/env bash -e
# remove application
rm -rf /Applications/iTerm.app
# optionally, remove profile data
# probably want to prompt before removing
# would also be nice to allow backing up of profile data (and restoring in the install script)
# rm -rf "$HOME/Library/Application Support/iTerm2" # there's also a iTerm folder in there that may need to be deleted
@sappharx
Copy link
Author

sappharx commented Apr 18, 2018

install script should handle failure to install docker and run uninstall script, e.g. when the CPU doesn't support virtualization instruction (i.e. when running in a VM where you didn't allow VT-x)

EDIT: I think this error would happen in the cp -R ... step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment