X11 on MacOS X and CMD-W

The most annoying thing with X11 on Mac is the shortcut CMD-W, especially when you are an Emacs user. On Emacs, CMD-W or META-W is the shortcut to put your selection into the cut buffer. But on Mac this is also the shortcut to close the window. This means that every time you type META-W on Emacs your Emacs window closes and you loose everything you are doing.

This recipe will explain how to remove the annoying CMD-W shortcut on X11.

 
Posted on Feb 21, 2009 by: Fred Cirera @ 15:22 Leave a comment Comments: 13

New "Security Guide" for MacOS X

Apple has just released a new configuration guide to help the the users of MacOS to secure their operating system. This manual is available for MacOS desktop and server edition as well as for Leopard (10.5), Tiger (10.4), and Panther (10.3).

This guide has more than two hundred pages describing the MacOS X architecture, secure installtion, information on patching, protecting and securing the peripherals, securing user account, backups, certificates, vpn configuration, etc. This is a very thorough manual.

This manual is intended for IT, and specialists. Users can browse through it to find interesting information and increase their security awerness.

Download your Mac OS X Security Configuration Guides

 
Posted on Jun 10, 2008 by: Fred Cirera @ 11:52 Leave a comment Comments: 7

Growable disk image

One of the features I like on my MacOS is the Support for SPARSE devices. Specifying -type SPARSE creates a disk image which expands as it is filled with data.

$ hdiutil create -volname FredBackup -size 10g -type SPARSE -fs HFS+ FredBackup
created: /Volumes/fred/FredBackup.sparseimage
$ ls -lh FredBackup.sparseimage 
total 36872
-rwxrw-r--  1 fred  fred    18M Dec 22  2007 FredBackup.sparseimage

$ hdiutil create -volname FredBackup -size 10g -type SPARSE -fs HFS+ FredBackup
created: /Volumes/fred/FredBackup.sparseimage
$ ls -lh FredBackup.sparseimage
total 36872
-rwxrw-r-- 1 fred fred 18M Dec 22 2007 FredBackup.sparseimage


Even though I created disk image with a size of 10GB, the real size of the disk image is only of 18MB. The size will grow as I fill the disk image.

If you want this image to be encrypted you can use hdiutil convert with the following options.

$ hdiutil convert -encryption -format UDSP FredBackup.sparseimage -o FredBackupSecure.sparseimage 
Enter a new password to secure "FredBackupSecure.sparseimage": 
Re-enter new password: 
Reading Driver Descriptor Map (DDM : 0)…
Reading Apple (Apple_partition_map : 1)…
Reading disk image (Apple_HFS : 2)…
...............................................................................
Elapsed Time:  9.107s
Speed: 1.8Mbytes/sec
Savings: 99.8%
created: /Volumes/fred/FredBackupSecure.sparseimage
$ 
$ ls -lh
total 73984
-rwxrw-r--  1 fred  fred    18M Dec 23  2007 FredBackup.sparseimage
-rwxrw-r--  1 fred  fred    18M Dec 23  2007 FredBackupSecure.sparseimage

$ hdiutil convert -encryption -format UDSP FredBackup.sparseimage -o FredBackupSecure.sparseimage
Enter a new password to secure "FredBackupSecure.sparseimage":
Re-enter new password:
Reading Driver Descriptor Map (DDM : 0)…
Reading Apple (Apple_partition_map : 1)…
Reading disk image (Apple_HFS : 2)…
...............................................................................
Elapsed Time: 9.107s
Speed: 1.8Mbytes/sec
Savings: 99.8%
created: /Volumes/fred/FredBackupSecure.sparseimage
$
$ ls -lh
total 73984
-rwxrw-r-- 1 fred fred 18M Dec 23 2007 FredBackup.sparseimage
-rwxrw-r-- 1 fred fred 18M Dec 23 2007 FredBackupSecure.sparseimage


With the last command a new volume has been created with the same characteristics of FredBackup.sparseimage but encrypted. You can get rid of the previews non encrypted disk image.

Carefully store the password in a safe place or use the KeyChain to save this password because there is no way to decrypt the content of your new disk image without it.

Your disk image is read. To be used you just have to mount/attach it. You can either use the graphical interface and double click on the FredBackupSecure.sparseimage icon, or use the command line interface hdiutil attach to mount your new volume.

The Volume will be mounted on /Volumes/FredBackup which is the nane we gave during its creation with the option -volname FredBsckup.

Once you are done using your disk image you detach/unmount/eject the volume by using the command detach from hdiutil.

$ hdiutil attach FredBackupSecure.sparseimage
Enter password to access "FredBackupSecure.sparseimage": 
/dev/disk3          	Apple_partition_scheme         	
/dev/disk3s1        	Apple_partition_map            	
/dev/disk3s2        	Apple_HFS                      	/Volumes/FredBackup
$ 
$ cp -rp /Users/fred/Movies /Volumes/FredBackup
$ 
$ hdiutil detach /Volumes/FredBackup
"disk3" unmounted.
"disk3" ejected.
$ 
$ ls -lh
total 112888
-rwxrw-r--  1 fred  fred    55M Dec 23  2007 FredBackupSecure.sparseimage

$ hdiutil attach FredBackupSecure.sparseimage
Enter password to access "FredBackupSecure.sparseimage":
/dev/disk3 Apple_partition_scheme
/dev/disk3s1 Apple_partition_map
/dev/disk3s2 Apple_HFS /Volumes/FredBackup
$
$ cp -rp /Users/fred/Movies /Volumes/FredBackup
$
$ hdiutil detach /Volumes/FredBackup
"disk3" unmounted.
"disk3" ejected.
$
$ ls -lh
total 112888
-rwxrw-r-- 1 fred fred 55M Dec 23 2007 FredBackupSecure.sparseimage


As you can see in the preview exemple. After we copied some data to the volume its size has dynamically grown.

If you free space in that volume you can use the command hdiutil compact to decrease the size of the disk image. As shown in the following example the disk image goes from 55MB to 39MB after we deleted the file dv2003.mov

$ hdiutil attach FredBackupSecure.sparseimage 
Enter password to access "FredBackupSecure.sparseimage": 
/dev/disk4          	Apple_partition_scheme         	
/dev/disk4s1        	Apple_partition_map            	
/dev/disk4s2        	Apple_HFS                      	/Volumes/FredBackup
$ 
$ rm /Volumes/FredBackup/Movies/dv2003.mov 
$ 
$ hdiutil detach /Volumes/FredBackup/
"disk4" unmounted.
"disk4" ejected.
$ hdiutil compact FredBackupSecure.sparseimage 
Enter password to access "FredBackupSecure.sparseimage": 
Starting to compact…
Reclaiming free space…
..............................................................................
Finishing compaction…
...............................................................................
Reclaimed 16 MB out of 10.0 GB possible.
$ ls -lh
-rwxrw-r--  1 fred  fred    39M Dec 25  2007 FredBackupSecure.sparseimage
$

$ hdiutil attach FredBackupSecure.sparseimage
Enter password to access "FredBackupSecure.sparseimage":
/dev/disk4 Apple_partition_scheme
/dev/disk4s1 Apple_partition_map
/dev/disk4s2 Apple_HFS /Volumes/FredBackup
$
$ rm /Volumes/FredBackup/Movies/dv2003.mov
$
$ hdiutil detach /Volumes/FredBackup/
"disk4" unmounted.
"disk4" ejected.
$ hdiutil compact FredBackupSecure.sparseimage
Enter password to access "FredBackupSecure.sparseimage":
Starting to compact…
Reclaiming free space…
..............................................................................
Finishing compaction…
...............................................................................
Reclaimed 16 MB out of 10.0 GB possible.
$ ls -lh
-rwxrw-r-- 1 fred fred 39M Dec 25 2007 FredBackupSecure.sparseimage
$

 
Posted on Dec 24, 2007 by: Fred Cirera @ 17:37 Leave a comment Comments: 11

Leopard first impressions

This afternoon I have installed MacOS 10.5, better known as Leopard. Here are some of my first impressions.

  • The new finder is way better. Everything important is on the left side bar. One of the sections I find interesting is the shared section. I have a bunch of disks I share through the network. I also have some machines I have converted into small severs. Just a few clicks in the shared section, I can now access the disk or the machines on my network.
  • Screen Sharing is great. Before I was using the free version of VNC to do administrative work on my small servers. Screen Sharing uses the same protocol as VNC but it is faster. The cut and paste and drag & drop from the desktop to the remote desktop works well. I can even have access to my Windows XP box. I just have to run a VNC server on Windows.
  • I don’t have much to say about Spaces it is convenient, and it does the job. Before I was using Virtue.
  • Spotlight seems to be faster. My main machine is an old PowerBook G4 and spotlight was a little bit slow on Tiger. It seems they improve the performances on Leopard.
  • Preview also has been improved. Now you can do simple images manipulations, such as select, extract shapes, resize, and convert images into other formats.
  • I also like the new Mail.app. Integrating the Notes, and To Do List into the mail, seems to be a good idea. Before I was saving my notes and list of things to do into files, all over my disk. I was loosing them frequently. Now everything has been centralized into mail. I have played a lot with the Calendar The integration with the mail seems OK.
  • Before installing Leopard, I was very excited to see how Time Machine worked with FileVault. That was the big disappointment of the day. Time Machine does not work if your home directory is encrypted with FileVault.
  • One more thing I found disappointing is the poor stability. I had a crash with Mail.app and one with Preview. I hope these problems will be fixed soon by Apple. We don’t want MacOS to look like some of the Microsoft products.

That’s all for today. If I find something wrong or great I’ll keep you posted.

 
Posted on Oct 30, 2007 by: Fred Cirera @ 12:46 Leave a comment Comments: 4

Using hdiutil to encrypt backups

In the previews article I have explain how backup of my important documents on a CD or DVD, in just 2 easy steps. This is great, but I am not not very satisfy with this solution. All my most important documents, containing private, professional, and personal information are written in clear, readable by anyone, on a CD. If I loose that CD, or if it get stolen from me, all these information can be at risk.

In this article we are going to use the same principle as described before to create an encrypted backup.
 
Posted on Oct 22, 2007 by: Fred Cirera @ 10:29 Leave a comment Comments: 28

Manipulating disk images with hdiutil

Let's have fun with HDUTIL(1). Ok the word "fun" is maybe too strong. Let's play with hdiutil to create and manipulate disk images.

Hdiutil is an command line utility to manipulate disk images on MacOS X. To use hdiutil you type at the shell prompt:
$ hdiutil action_verb [options]
$ hdiutil action_verb [options]

Common action verbs are attach, detach, verify, create, convert, and burn. In this article we are going to use hdiutil to backup our important data using encryption.
 
Posted on Oct 20, 2007 by: Fred Cirera @ 11:10 Leave a comment Comments: 18