Automation of Mac OSX setup
Script to automate the setup of my Mac’s
Login to the Apple Store with your Apple ID
(Optional) Export the environment variable SETUP_PROFILE with the name of the profile to apply (they are located in Profiles/Profiles.*). You may also export the environment variable SETUP_BREWFILES with a list of brewfiles to install extra to those defined in the profile (the name of the brewfiles is the text after the file named Brefiles/Brewfile.*)
export SETUP_BREWFILES="Internet Office"
export SETUP_PROFILE="Work" # Or "Personal"
Execute:
curl -fsSL https://www.johandry.com/mac/setup.sh | bash
Install manually the applications that failed to install or follow the instructions that an installed program require.
Complete the setup following the instructions from the Manual Setup section
It may be required to execute again the setup script, update the Mac with Apple Store or maybe restart it. Pay attention to the output of the script, there may be manual actions required.
To update all the brew installed applications, execute:
brew update
brew upgrade
All the applications were installed with Brew Bundle. To restore the system to the initial applications execute the following command, then you can execute again the curl-setup-bash line:
brew bundle cleanup --global
Yes, Docker is installed but it may fail, as it’s an critical application double check and install it manually, so:
The Virtual Box installation may fail due to a security requirement from MacOS. If it fail the instructions will be provided during the brew install.
Double check it’s correctly installed, if failed or still failing download and install it from here.
Configure your access to AWS through the CLI. Find the AWS access keys, it should be a CSV document. Open Terminal and execute the following command to enter the AWS Access Key ID and AWS Secret Access Key:
aws configure
The region could be us-west-2 and the output format json. Verify the access with the command:
aws ec2 describe-key-pairs
Open Google Chrome and login with your user.
In the past the brew install of Chrome caused some problems every time there is a Chrome update. If it happens again, uninstall the brew cask for Chrome, download it from here and install it.
brew cask uninstall google-chrome
MinimalAdvance Configuration, then Edit to select:
Directory to ~/WorkspaceHome directoryReuse previous...10% Gray125 and Rows to 35Unlimited scrollback and Silence bellStatus bar enabled, click on Configure Status Bar then drag: CPU Utilization, Memory Utilization, Network, Current Dir, git state, Composer and click on Auto-RainbowCmd + Shift + D, then Cmd + Shift + S, name the arrangement 2 PanelsCmd + D, then Cmd + Shift + S, name the arrangement 3 PanelsOpen Default Window Arrangement3 Panels and Set DefaultTheme to Dark and Status bar location to Bottom~/Downloads, some suggestions are:
~/Downloads directory and select all the downloaded themesTips:
Cmd + Option + <Arrow Key>, Cmd + [ or Cmd + ].Cmd + Shift + EnterCmd + Wmkdir themes; mv *.itermcolors* themes; cd themes; for f in *; do mv $f ${f%*.txt}; doneThe Go extension require a bunch of tools installed, to install them, create a new file with a simple Go code:
package main
import "fmt"
func main() {
fmt.Println("hello")
}
Save it and an alert at the bottom will ask to install all the dependencies required by the VSCode Go package. Select All and wait until all are installed.
The default Python interpreter is Python 2, to select Python 3 open the Command Palette (⇧⌘P) and -partially - type Python: Select Interpreter, then select the correct Python 3 interpreter.
If you don’t see it in the list try to reinstall Python 3 and/or restart Visual Studio Code:
brew reinstall python3
brew link python3
python3 -V
where python3
Login to the following workspaces:
Open all the installed applications and make sure they are working, most of them require to accept something or require an user input. These are some of these applications:
To modify the list of applications to install or modify the script, first clone or pull the project.
The setup.sh script install automatically a list of applications using Homebrew and mas-cli. It will also execute other tasks such as create a Workspace directory, customize the Zsh theme and more.
There is a file per Mac named with the hostname, i.e. Brewfile.Johandrys-MacBook-Pro.local, and the file Brewfile.Base with all the applications every mac should have. These Brewfiles are required by Brew Bundle and they list all the applications to install. Comments starting with # are allow.
You can create a list of installed applications with the following command:
brew bundle dump --describe
Then move the applications in Brewfile to the right Brewfile.*.
The setup.sh script will create a Brewfile that will be saved to ~/.Brewfile so you can upgrade all the applications at any time with:
brew bundle install --verbose --global
Or remove the none required programs with:
brew bundle cleanup --global
To list the existing Visual Studio Code extensions execute the command:
code --list-extensions
Then update the file Brewfile.VSCode.
To remove an extension, use the command:
code --uninstall-extension <extension_name>
To list the installed Atom packages, use the command:
apm list --bare --packages --installed --enabled
Then update the file Atom_Packages.lst but do not include the version number (including the @ character) unless an specific version is required.
To remove the no needed packages, use the command:
apm uninstall <package_name>
To test locally (not always recommended), execute:
LOCAL_SETUP=1 ./setup.sh
The environment variable LOCAL_SETUP=1 use the files locally instead of getting them from GitHub.
If no parameter is pass the script will use the Profile.Test profile instead the one with the hostname. Or, you may pass a list of brewfiles extensions (the name after Brewfile.) to use them.
Notice that Brewfile.Base will always be used.
It’s possible to test the script using Vagrant. Follow these steps to use OSX Setup with Vagrant:
vagrant up
vagrant ssh
$ cd OS_Setup
$ LOCAL_SETUP=1 ./setup.sh Test
As mentioned above, you need to login to Apple Store with your Apple ID. Follow these steps at the Vagrant box:
vagrant password vagrantTo start over from scratch, execute vagrant destroy and start over by running vagrant up.