My macOS Cheat Sheet

Software Engineer at BMW, Oracle Certified Professional Java SE 11 Developer
How to set JAVA_HOME on macOS Monterey?
- First check which shell you are using (either bash or zsh).
For
zshshell, we can put the environment variables at~/.zshenvor~/.zshrc.echo $SHELL /bin/zsh On Mac OS X 10.5 or later, we can use
/usr/libexec/java_hometo return the location of the default JDK./usr/libexec/java_home /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/HomeOr list all installed java versions with
-V% /usr/libexec/java_home -V Matching Java Virtual Machines (3): 17.0.9 (x86_64) "Oracle Corporation" - "Java SE 17.0.9" /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home 17.0.9 (x86_64) "Oracle Corporation" - "Oracle GraalVM 17.0.9+11.1" /Library/Java/JavaVirtualMachines/graalvm-jdk-17.0.9+11.1/Contents/Home 11.0.13 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/HomeOpen the
~/.zshenvnano ~/.zshenv- Add the following content
export JAVA_HOME=$(/usr/libexec/java_home) - Source the file and print the $JAVA_HOME, done.
source ~/.zshenv echo $JAVA_HOME /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
Install node on macOS
Download the package at the official Node Website. The installation paths are as follows:
Node.js
/usr/local/bin/node
npm
/usr/local/bin/npm
Make sure that /usr/local/bin is in your $PATH.



