March 7

Remove Safari session auto-restore

enter the code below in a Terminal session

Holding the SHIFT key while launching Safari will also prevent the previous sessions windows from loading.

Category: Lion, Mac, Technical | Comments Off on Remove Safari session auto-restore
November 20

Enable Hidden iTunes Notifications On Mac OS X

Turns out there an iTunes Dock setting for the Mac, hidden deep inside the new Lion OS. Once activated, the Dock will produce a pop-up notification of which iTunes track is currently playing. Although you can program Growl, a useful little utility, to show similar notifications, you may prefer having the native one found in Lion.
The feature is only available to those running the latest Lion OS X 10.7. It just need to be activated. After following a few simple steps, a window will appear above the iTunes icon on your Dock each time a new track starts, displaying the artist and song title. The notification window will automatically remove itself after a few seconds.

Here’s how to activate it now:
Step 1: Quit iTunes.
Step 2: Open Terminal (Found in Macintosh HD > Applications > Utilities).
Step 3: Copy and paste the following command:

Step 4: (Optional) You can customize it even further by adding the iTunes icon inside the popup along with the song info. Just add the following command:

Step 5: Open iTunes and give it a try!

Reverting – Disable Hidden iTunes Notifications On Mac OS X


I’d like to think that I’m familiar with every song in my iTunes library, but decided to try the feature anyway. At first I thought it would be distracting, but found it unobtrusive and actually pretty cool! I think I may go ahead and keep it for a while. The process is completely reversible, anyway. If for any reason you’d like to deactivate the feature, simply follow these steps:

Step 1: Quit iTunes.
Step 2: Open Terminal.
Step 3: Copy and paste the following two lines:

Category: Lion, Mac, Technical | Comments Off on Enable Hidden iTunes Notifications On Mac OS X
August 21

Plugging mcrypt into PHP, on Mac OS X Lion 10.7

Perfected for Snow Leopard, now on to the king of the jungle.

 Now let’s get moving…
The following instructions cater to those who

a) are developing on OS X Lion 10.7.X,
b) need the capabilities provided by mcrypt during their PHP development, and
c) do not want to completely recompile PHP to get there.
You’ll get mcrypt loading dynamically for use in PHP with this method.
First, you are going to need a few things…
1) libmcrypt-2.5.8, which you can pick up here; NOTE: make sure to get libmcrypt and not mcrypt.
2) PHP 5.3.6 source, which you grab here; ADDITIONAL NOTE: You may update your OS X at some point, and PHP may get updated along with it. Use phpinfo() to check your version of PHP, and then download the PHP source for that version.
and
3) Xcode 4.1 tools, which you can pick up in the App Store.
Next, create a directory at root called ‘SourceCache’ and dump the files from #1 and #2 in there and unwrap.
Move to the libmcrypt-2.5.8 directory, and punch in this…
MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –disable-dependency-tracking
and then…
make -j6
and finally…
sudo make install
libmcrypt is ready – now for the PHP extension…
Move back to /SourceCache, then down to php-5.3.6/ext/mcrypt – type…
/usr/bin/phpize

(phpize should be in /usr/bin – if not go find it and change the command as appropriate)
Then configure as follows…
MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config
Again: make -j6 then sudo make install
Make sure you have php.ini in the /etc directory – it will probably be php.ini.default to start, particularly if you’ve just done an OS X upgrade or a clean Lion install, so rename it.

Ensure that enable_dl = On but do not remove the ; from in front of ;extension_dir = “./”.

Add one line to the .ini file in the Dynamic Extensions section… extension=mcrypt.so
Restart Apache – you should be all set (again), according to phpinfo():

Mcrypt on OS X Lion

Category: Lion, Mac | Comments Off on Plugging mcrypt into PHP, on Mac OS X Lion 10.7
August 19

Installation of MySQL server on Mac OS X Lion

At the time of writing this post, MySQL Server on MySQL site doesn’t have installer package for OS X 10.7 (aka Lion) but 10.6 Package works just fine for 10.7 as well. This may change soon and we may see package for OS X 10.7 as well or may be rename current package to 10.6 & above.

Installing MySQL community server:

  1. Download the latest  64-Bit DMG Archive (Apple Disk Image) from MySQL Site (http://dev.mysql.com/downloads/mysql/). Current latest version is 5.5.14 which I’ll be using to install on my machine.
  2. Mount the Disk Image (I mean open/double-click the DMG file) and install MySQL server by double-clicking the PKG file (in my case mysql-5.5.14-osx10.6-x86_64.pkg) and follow onscreen instructions. ( It will ask for Master password, as it installs MySQL server in /usr/local )
  3. Add /usr/local/mysql/bin to your path by editing .profile file. (Optionally you can create alias to mysql and mysqladmin as mentioned in README File)
  4. You can start MySQL server by running “/usr/local/mysql/bin/mysqld_safe &” from terminal but Disk image you downloaded also consists of Startup Package & Preferences Pane which allows you to start/stop MySQL server from System Preferences and even Automatically Start MySQL Server at Startup.

*Please note /usr/local/mysql is only symlink to /usr/local/mysql-5.5.14-osx10.6-x86_64 which means when you upgrade to new version symlink will be changed to point to new version but won’t be deleting the older version. However you need to copy your data directory to new location to make sure your existing databases are intact post upgrade.
Installing MySQL Startup Scripts & Preferences Pane (OPTIONAL)

  1. Double Click MySQLStartupItem.pkg and Follow on screen instructions (You will be asked for Master Password)
  2. Double Click MySQL.prefPane which will add MySQL to OS X System Preferences and it should like something like below
  3. MySQL Preference Pane

  4. Check Automatically Start MySQL Server on Startup to start MySQL server at boot time.
Category: Lion, Mac | Comments Off on Installation of MySQL server on Mac OS X Lion
July 30

OS X Lion mysql sock path

I just installed Lion and for some reasons my internal website stopped working due to the mysql lock file not being found. I found out that the new osx installation changed the mysql sock file default path from /var/mysql/mysql.sock to /tmp/mysql.sock.

So, to re-enable everything, do:

  1. shut down your Web Sharing
  2. cp /etc/php.ini.default /etc/php.ini (for some reasons my old php.ini got renamed to php.ini.default php.ini-5.2-previous…)
  3. modify /etc/php.ini, change ALL /var/mysql/mysql.sock to /tmp/mysql.sock
  4. enable Web Sharing
Category: Lion | Comments Off on OS X Lion mysql sock path
July 29

Dealing with Lion’s Hidden Library

Accessing the Library Folder in Lion — While Apple clearly believes that most users shouldn’t be messing around in the ~/Library folder, the company is aware that many of us do need quick access to it. So the new way of viewing ~/Library is to hold the Option key and choose Go > Library in the Finder. You can even press Option after you drop the Go menu. Of course, you could also choose Go > Go to Folder (Command-Shift-G) and enter ~/Library in the dialog that appears, but that’s unnecessary effort.Once you can see the ~/Library folder, you can drag its icon (or its proxy icon from a Finder window’s title bar) to either the toolbar or sidebar of a Finder window. Once there, accessing it is merely a matter of clicking the icon.

If you’d just like your ~/Library to be visible normally in the Finder, that’s easy too; just enter this command in Terminal:

chflags nohidden ~/Library

And if you wish to reverse that action, just repeat the command without no, as in:

chflags hidden ~/Library

That’s all there is to it — regardless of whether you agree with Apple’s decision to hide the ~/Libraryfolder, there’s no reason it has to get in your way.

Category: Lion | Comments Off on Dealing with Lion’s Hidden Library