Setup developers Mac computer - atabegruslan/Notes GitHub Wiki
PATH
- https://stackoverflow.com/questions/415403/whats-the-difference-between-bashrc-bash-profile-and-environment
- https://superuser.com/questions/1403007/zsh-npm-node-nvm-command-not-found-after-installing-ohmyzsh
In my current Mac, I have the below in my ~/.zshrc
export MAMP_PHP=/Applications/MAMP/bin/php/php8.2.0/bin
export PATH="$MAMP_PHP:$PATH"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Above can also be put into ~/.profile
See also Linux's: https://github.com/atabegruslan/Notes/wiki/Setup-developers-Ubuntu-computer#linuxs-env-vars
MAMP with many PHP versions
- https://stackoverflow.com/a/16785309
- https://gist.github.com/vuthaihoc/7fb6cad80705aa08b2a508c115b9abc6
- https://gist.github.com/codeadamca/09efb674f54172cbee887f04f700fe7c
- https://www.youtube.com/watch?v=N8KRaPnz1e8
- https://jellystyle.com/2012/12/installing-php-extensions-with-mamp
- https://gist.github.com/ngohuytrieu/5b5c8ba49c78d9247d500db400fd6c7a
- https://gist.github.com/codeadamca/09efb674f54172cbee887f04f700fe7c?permalink_comment_id=5078538
- https://medium.com/@vafrcor2009/old-mamp-support-for-php-latest-versions-7-2-x-7-3-x-de64283b6e2d
- https://www.mamp.info/en/release-notes/mac/
- https://www.mamp.info/en/downloads/
Startup
Open System Preferences.
Go to Users & Groups.
Choose your nickname on the left.
Choose Login items tab.
Check startup programs you want to remove.
Press the “–” sign below.
Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo >> /Users/rus/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/rus/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Git
brew update
brew install git
Github SSH
ssh-keygen -t rsa -b 4096 -C "[email protected]"
eval "$(ssh-agent -s)"
pbcopy < /Users/rus/.ssh/id_rsa.pub
Node
brew install node@20
Notes
node@20 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have node@20 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/node@20/bin:$PATH"' >> ~/.zshrc
For compilers to find node@20 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/node@20/lib"
export CPPFLAGS="-I/opt/homebrew/opt/node@20/include"
Then open new terminal
node -v
npm -v
Yarn
npm install --global yarn
Notes
# if yarn is installed, but not linked
brew link yarn
Java
https://stackoverflow.com/questions/69875335/macos-how-to-install-java-17
brew install openjdk@17
Notes
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
openjdk@17 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have openjdk@17 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk@17 you may need to set:
export CPPFLAGS="-I/opt/homebrew/opt/openjdk@17/include"
Then open new terminal
java -version
openjdk version "17.0.13" 2024-10-15
OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.13+0, mixed mode, sharing)