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.

 

VirtualBox Shared Folders with CentOS Server Guest

I have recently switched from MacBook Pro to Mac Mini for my development machine and I have also switched from VMWare to VirtualBox simply for the sake of OpenSource. Because the new Mac Mini gives me 16GB of DDR3 RAM, which gives me the power to run my own virtual server machine as my sandbox to develop on. To make my life a bit easier, I want to share my coding folder on Mac Mini with the server in the virtual machine, so that I don’t need to keep syncing files manually. Luckily VirtualBox supports this, but need a bit of work to get it going.

In this article I will be creating a shared folder within VirtualBox that will link my /Users/ericlin/Projects directory with one on the CentOS box under /mnt/projects.

Firstly, within VirtualBox, select the guest machine you wish to contain the shared folder.

Press the Settings button and choose the folder that you want to share on your host machine, and give appropriate access level:

Start your guest machine and login as normal.

Select Devices -> Install Guest Additions, this will insert an iso image into the CDROM, but we need to mount it manually:

sudo mkdir /media/cdrom
sudo mount /dev/cdrom /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only

Now if you do “ls” on /media/cdrom, you will see the following contents:

Run file “VBoxLinuxAdditions.run” to install the addition:

sudo /media/cdrom/VBoxLinuxAdditions.run

Running it the first time I got the following error:


To fix it, simply do what it asks you to do:

yum install kernel-devel-2.6.32-279.el6.x86_64

Wait for it to finish and try again with previous command:

sudo /media/cdrom/VBoxLinuxAdditions.run

Don’t worry about the FAILED message in the last line, we are running the server version, not the desktop version, so no Window System is required. Once everything is finished, reboot the virtual machine:

sudo reboot

Lastly, you just need to mount the folder. I created the directory that is going to be mounted to: /mnt/projects

sudo mkdir /mnt/projects

Now you just need to mount the shared folder to the newly created directory using the following command.

sudo mount –t vboxsf /Users/ericlin/Projects /mnt/projects

Then you should be able to

cd /mnt/projects
ls -sh

If you want the foler to be mounted automatically on start up, add the following line to your /etc/fstab file:

Projects        /home/ericlin/em    vboxsf    defaults    0 0

MAMP + ImageMagic

My recent project from home requires me to use ImageMagic library for PHP under MAMP. However, MAMP does not ship ImageMagic natively, so I have to use Google’s help to get some answers. After about 2 days of researching, I finally got it working. The following was what I did:

MacPorts

Firstly I installed MacPort, then install ImageMagic using command:

sudo port install ImageMagick

This will take a while, so please be patient. For me, it took around 20-30 minutes to install all dependencies.

Update MAMP envvars

Open file /Applications/MAMP/Library/bin/envvars and comment out the first two lines and add the line below:

#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
#export DYLD_LIBRARY_PATH

export PATH="$PATH:/opt/local/bin"

Finally restart MAMP server.

PHP Imagick

I do have PHP Imagick installed, I am not sure whether it will work without it or not, if it doesn’t work for you, try to install it first.

To installed imagick, using pecl command:

pecl install imagick

use “/opt/local” as installation directory on prompt.

Then restart MAMP again.

It worked for me under OS X 10.6.8 with MAMP 2.0.5 installation, hope this helps.

VMWare Fusion Window 7 “There Are No Images Available” Installation Error

Tonight I was trying to install Windows 7 in VMWare Fusion under MacBook Pro, but I kept getting the following error:

It was really frustrating as I have tried to switch between 64-bit and 32-bit but still not working. After some googling it turned out to be a very simple fix. What I needed to do was to disconnect my virtual floppy disk from the newly created virtual machine for Windows 7. I did the following steps to solved the problem:

1. Power down the Windows 7 virtual machine

2. Go to virtual machine settings (right click and choose “Settings”)

3. Click on “Other Devices” from the bottom right:

4. Make sure floppy disk is selected from the left and then click on the un-tick the box before the “Connected” to disconnect the floppy

5. Power back on the virtual machine and continue the installation as usual.

It works perfectly fine, hopefully it is useful to some people.

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!