OSX

Fix Java Won’t Update in OSX Sierra

I have an issue using Oracle JDK in my laptop that the auto updater successfully update the JDK but the update is not applied on my system. I check my java version using.

$ java -version

But still showing the old version rather than the latest one.
I fix my issue by putting this following line on my bash configuration.

export PATH="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin:$PATH"

Homebrew: Fixing error “/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory”

My homebrew accidentally error when I’m running update command “brew update” and below are the error stackstrace.

$ brew update
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
Error: update-report should not be called directly!

I’m fixing my issue by run this single command.

$ cd "$(brew --repository)" && git fetch && git reset --hard origin/master

Reference: https://discuss.circleci.com/t/brew-update-command-fails/5211/3

Fix MongoDB errno:61 Connection refused on OSX

I have just installed MongoDB thru homebrew, but I got this error when trying to open mongodb shell after the installation. Below is the error stracktrace.

MongoDB shell version: 3.2.6
connecting to: test
2016-05-29T22:57:35.930+0700 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2016-05-29T22:57:35.931+0700 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

This error caused by the mongodb service not yet started. I fixed this by starting the service following this command.

$ brew services start mongodb

Reference: http://stackoverflow.com/a/23465286/1936697

Fix NVM Keeps Forgeting Node Version in New Terminal Session on OSX

I’m installing NVM on OSX but apparently NVM not saving my config, so after installing latest version of node.js and switch to it in new terminal session or after restarting the system, NVM still using old version of node.js.

And follow this link to fix this issue. 😀