Adding here as reference.
- node -v
- npm cache clean -f
- npm install -g n
- n stable\
- node -v
Adding here as reference.
I believe up until Yosemite, I didn’t have issues setting up environmental variables (i.e. JAVA_HOME) via my .bash_profile. As I upgraded, that no longer worked, so I found another way: use a custom .plist in your LaunchAgents folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my.startup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>launchctl setenv APPS_CONFIG '/Users/anton/box/Source/apps_config' | launchctl setenv CATALINA_BASE '/usr/local/Cellar/tomcat7/7.0.63/libexec' | launchctl setenv CATALINA_HOME $CATALINA_BASE | launchctl setenv HOMEBREW_GITHUB_API_TOKEN 'b20aeb90b4d0cbc8352bdc6059073b7be473e4e3' | launchctl setenv JAVA_HOME '/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/' | launchctl setenv M2_HOME $'/usr/local/Cellar/maven@3.2/3.2.5/libexec' | launchctl setenv GATLING_HOME '/usr/local/Cellar/gatling/2.1.7/'</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I wanted more information in my bash prompt, such as date/time and the directory I was in. Here’s what it looks like:
And this is what I added in my ~/.bash_profile:
PS1='${debian_chroot:+($debian_chroot)}\d \T > \[$(tput sgr0)\]\[\033[01;32m\]\u@\h\[\033[00m\] : \[\033[01;34m\]\w\[\033[00m\]\n\$ '
Run source ~/.bash_profile and enjoy. 🙂
BTW, there’s also a website that you can use to create your own: http://bashrcgenerator.com/.
I needed a one-liner JSON payload, but only had the pretty-printed version. And, removing the whitespaces manually was NOT an option. It was super easy on a Mac; just do the following:
brew install jq
cat prettyprinted.json | jq -c .
If you’re a Java developer like me, you will need to work on various Java versions. If so, adding the following in your ~./bash_profile makes switching between versions a snap. (As of this writing, I’m running on OS X El Capitan.)
alias java6='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6);java -version'
alias java7='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7);java -version'
alias java8='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8);java -version'
alias java9='export JAVA_HOME=$(/usr/libexec/java_home -v 9);java -version'
NOTE: Java 9 above is the beta version, so it may be 1.9 once it’s been finalized.