Mac OSX: Add Hosts to Local hosts file

September 14th, 2009 | Author: Sunny

I was in the hospital for awhile, so I have not had a chance to update my blog.

Yesterday I installed OpenSuse to my VM on my Mac Pro because I wanted to play with Magento, so I installed Apache, PHP, and mySQL with all necessary modules. Everything is going well, and Magento(1.1.3) finally installed successfully with it’s sample data today(it was a bitch until I changed the hostname to localhost.com!) . However, I set my VM hostname as localhost.com, and I would like to access it from my OSX Safari. And of course, my DNS records localhost.com as something else on the internet, but not pointing to my VM’s IP address.

So what should I do? I have to change the “hosts” file on my Mac. It is located at “/private/etc/hosts“. In order to edit it, you have to grant yourself as root privilege, but by default “root” account is disabled in OSX. Therefore, you will use command “sudo“. For example, I use vi for editing, I will type “sudo vi /private/etc/hosts” in my terminal windows, and it will prompt me to enter a password(which it should be your admin password on OSX). Once you get authorized, you should be able to edit the hosts file.

To enter a new hostname in hosts file, in a new line at the end, type in IP address, then Tab, and the hostname. Once saved, Mac OSX should resolve the hostname to that IP address.


List Open ports on Mac OS X

July 16th, 2009 | Author: Sunny

Found this on the web. I used to use fport to see which port is open on my machine, but it only works for Windows. So, this will be helpful for any of you if you are looking for the same information.

open terminal windows, and type: sudo -lsof -i -P | grep -i “listen”

P.S.
| grep -i “listen” <— this is optional… but help you to grep which port is listening


Save Youtube Video from Safari

July 13th, 2009 | Author: Sunny

My sister was being interviewed on TV something about plastic bag tax. Her husband wants to save this interview, but they have already missed the broadcasting time. And thank to the Internet, it has been showing on Youtube. haha. So, he wants me to help him to save it and crop my sister’s part out. I looked around, but did not find any good converter. There was a site that actually you can copy Youtube’s URL, and convert the video. However, the quality was not good at all, and no sound!!! (still couldnt figure out why)

And I found this: http://www.usingmac.com/2009/1/20/free-download-hd-youtube-video

You can save youtube video from Safari! Following this steps on Safari:

1. Open YouTube URL to video. Append URL with &fmt=18 to view HD video (you may not need it if you don’t need HD video)
2. Show up Activity Monitor (Command-Option-A)
3. Seek for file with largest size and Option-Click it
4. The download should be started with default name video.mp4

Isn’t it nice? and I used iMovie to crop my sister’s part out.

Category: Mac Stuff | Tags: , , , | Leave a Comment