Tag: os x
-
How to update nodejs on OS X
Adding here as reference. node -v npm cache clean -f npm install -g n n stable\ node -v
-
OS X: Setting system-wide environment variables
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: Go to ~/Library/LaunchAgents Add something like the below and then reboot, or unload-load it via launchctl unload…
-
My custom bash prompt
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…
-
Unpretty print a JSON file
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: In a terminal, install “jq” with brew like so brew install jq With your pretty-printed JSON in a file: cat prettyprinted.json | jq…
-
Switching between multiple Java versions on OS X quickly
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…