Mavericks Upgrade Removes Java & DNS Domain Search

Yesterday when Apple prompted me with a new OS X 10.9 upgrade available to be installed, I followed  and upgraded. Guess what? ISSUES.

I use PHPStorm for PHP, IntelliJ IDEA for Java and PyCharm CE for Python, but after the upgrade, none of them are working anymore. Because all three of them are from JetBrains and based on Java, so my immediate thought was that Java is missing.

After Googling and it turned out to be the case, Mavericks simply removes your Java installation. To fix it, I downloaded and installed Java for OS X , and everything back to normal again.

Another issue I found was that the DNS search domain has been disabled. So if you have:

search somedomain.net
nameserver 10.2.2.2

when  you try to

ssh test

It will not search “test.somedomain.net” anymore. To fix it, open up file:

sudo vim /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Add “<string>-AlwaysAppendSearchDomains</string>” into the following section:

<array>
<string>/usr/sbin/mDNSResponder</string>
<string>-AlwaysAppendSearchDomains</string>
</array>

And finally reload mDNSResponder service:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

This should enable you to perform DNS lookups the same way as was before.

Mac OS X Keyboard Shortcut For Lock Screen

I have recently migrated from 8G old MacBook Pro to 16G Mac Mini for my work station in our office. When I was using MacBook Pro, I simply close the laptop and took home, so never need to worry about locking screens when I leave. However, I can’t take the new Mac Mini with me, but I don’t want to leave the screen open after I leave work in the evening, so I need to know the keyboard shortcut to lock the screen under 1 second.

Here is the shortcut:

⌃ + ⇧ + ⏏ (Control + Shift + Eject)

According to John-Paul Bader, it was available since Mac OS 8.

If you want to learn more Mac shortcuts, here is the link, thanks to Dan Rodney.

 

Update Screen Capture Destination Folder in Mac

In Mac OS X, everytime you take a screenshot using “Command + Shift + 4” or “Command + Shift + 3”, it saves the screenshot file under ~/Desktop. I really don’t like it as it makes my desktop un-managable. Rather I would like to save all screen captures to a specific folder on my desktop.

I have found out a simply way to do it:

defaults write com.apple.screencapture location /path/

For example, I prefer to save to ~/Desktop/screenshots foloer, simply have:

defaults write com.apple.screencapture location ~/Desktop/screenshots

Make sure the destination folder does exist!

To apply the changes immediately, type in your shell:

killall SystemUIServer

After this you desktop of be free of “Screenshots”.

Enjoy!

Memory Issues in Mac OS X

Lots of information on websites state that Mac is really good for memory management and you shouldn’t worry too much about it as Mac will handle it for you nicely. However, I have found it very untrue.

My MacBook Pro has 8GB of memory, but it always climbs up to use all my momeries and slows down everything.

You can see that I only had 33MB of memory left to use. There were more than 2GB of inactive memories that can be re-claim but Mac had refused to do so. My system becomes un-responsive proved it. Most of cases I have to quit certain memory hungry applications and restart them to re-claim some memory back, like FF4 who has been famous from its memory management.

Just in case you might wonder what those memories mean:

Free memory is available to be used right now

Wired memory is basically system memory for the kernel and other stuff

Active memory is memory being used right now

Inactive memory stores info from recently quit applications. The idea with inactive memory is that if you quit and app and start it up again it’s going to launch nice and quick because the info is still in RAM.

There is a “purge” command in Mac if you have installed developer tools which will allow you to force Mac to re-claim memories in the In-active state. However, your computer will become un-responsive during the operation, which normally takes from 30 seconds to up to more than 1 minutes.

This is a command that I don’t think you should use often as it freezes up your system for a while, I will only use it when it is absolutely necessary.

There is not much you can do about it unless Apple solves this problem, but I doubt it in the short term.