Basic configuration tips to have your Mac up and running for Data Engineering activities and to work well with admin and non-admin accounts
- Download the .pkg installer from python.org here
Best way to install XCode might not necessarily be through the App Store
- Log in and download XCode installer here
- Open terminal and go to the Download folder
xip -x <file_name.xip>Bypass verification step when unzipping- On Finder go to the 'Applications' and remove any previous XCode app and just drag and drop from 'Downloads' to 'Applications'
xcode-select --installInstall CLT (Command Line Tools) before installing Homebrew- Download the new .pkg installer here
- Add Homebrew to your PATH run brew shellenv in your shell profile (e.g. ~/.bash_profile or ~/.zprofile)
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profileUpdate the PATH and activate it
brew cask install myapp --appdir=~/ApplicationsInstall Casks to Home Directory
Reference: https://gist.github.com/Justintime50/de232f266cea55faf82e9d65d5bd94c0
- When opening terminal, there's a message to switch to Zsh:
The default interactive shell is now zsh. To update your account to use zsh, please run 'chsh -s /bin/zsh'. For more details, please visit https://support.apple.com/kb/HT208050 - .bash_profile vs. .zprofile: If you have environment variables or startup commands in .bash_profile, you may want to move them to .zprofile. zsh will not automatically source .bash_profile, so any settings or configurations there won't be applied in a zsh session.
- .bashrc vs. .zshrc: The .bashrc file is for interactive bash sessions. In zsh, the equivalent is .zshrc. If you have aliases, functions, or other configurations in .bashrc, you might want to transfer them to .zshrc.
- However in OSX, ALL interactive shells are login shells hence many people do not create bashrc or zshrc.
chsh -s /bin/zshChange from Bash to Zshnano ~/.zprofileOpen the .zprofile file, it will empty if it didn't exist previouslyif [ -f ~/.bash_profile ]; then . ~/.bash_profile; fiAdd at the very bottom of the file ~/.zprofile. Everytime a Zsh session starts, it will run the bash_profile file.
- https://stackoverflow.com/questions/23233603/how-to-load-bash-profile-when-entering-bash-from-within-zsh
- https://carlosroso.com/the-right-way-to-migrate-your-bash-profile-to-zsh/
brew install gitInstall Git using Homebrew
- Download the pkg installer for Mac M1/M2 here
conda config --set auto_activate_base falseUse the system environment without conda as the default. This is remove (base) from terminal prompt after updating conda
conda create --prefix ./env python=3.10Create a virtual environment. First create a working folderconda activate ./envActivate the conda environmentconda install jupyter notebookInstall jupyter notebook server
- Shift + Command + P
- Select tpye "Create: New Jupyter Notebook"
- Machine Learning test https://www.youtube.com/watch?v=_1CaUOHhI6U and https://github.com/mrdbourke/m1-machine-learning-test
- To do: https://c51.lbl.gov/~walkloud/work_home/personal/setting-up-my-mac/homebrew
brew install --cask iterm2 --appdir=~/ApplicationsInstall iTerm2 with a non-admin will get an error about accessing /Applications (which you cannot write to without admin privileges), instead with the --appdir option it will write to ~/Applications (which you can write to). More here: Homebrew/homebrew-cask#27431
brew updatebrew install pyenvInstall pyenv using Homebrewecho 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profileSet up your shell environment for Pyenv for bash_profile step 1/3echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profilestep 2/3echo 'eval "$(pyenv init -)"' >> ~/.bash_profilestep 3/3source ~/.bash_profileActivate bash_profile file
- Pyenv github https://github.com/pyenv/pyenv