Home arrow OSX Tips
OSX Tips
See Status for Encryption in Progress Drive in OSX PDF
Tuesday, 21 October 2014
If you've choose to encrypt a hard drive in OSX and you want to see the status of the encryption process in Mac OSX run the following command from OSX's Terminal:

  diskutil cs list

If the drive still convert the partition to encrypted one you will see:

Conversion Status: Converting

If the process is finished, you will see:

Conversion Status: Complete

You might also be interested in the progress time of encryption. Look for:

Conversion Progress: x%

section. Where x is the percentage of encyption process.

Last Updated ( Tuesday, 21 October 2014 )
 
Add a Path to OSX Yosemite PDF
Sunday, 21 September 2014
In order to add a path (for example /opt/local/bin/) edit /etc/paths file and add the following on a separate line:

  /opt/local/bin/

 
Archive on multiple volumes using zip from OSX command line PDF
Saturday, 07 June 2014
If you want to archive a file or directory on multiple volumes using zip from OSX's command line, just open the terminal and type:

  zip -r -s 30 archive_filename.zip directory_to_archive

where:

-s 30 is the size of split volumes in MB.
-r is used to travel the directory structure recursively.

 
See Which App Uses a Network Port in OSX PDF
Friday, 24 January 2014
To see which app is using a network port in OSX just run:

  lsof -i -P |grep 80

Last Updated ( Friday, 24 January 2014 )
 
Disable Apache2 from MacPorts PDF
Saturday, 16 November 2013
Let's say you have Apache 2 installed from MacPorts and you've installed OSX Server. You might want to disable Apache2 from MacPorts so you will not have two different web servers running on the same port (of course you could always change port).

We will first stop Apache:

  sudo port unload apache2

Then we will disable launching Apache 2 from MacPorts at boot time:

  sudo rm /Library/LaunchDaemons/org.macports.apache2.plist

 
Installing and Managing Mac Ports (Quick Guide) PDF
Friday, 15 November 2013
To update your Mac Ports ( macports ) system run:

  sudo port -v selfupdate

To rebuild all installed Mac Ports after running an selfupdate:

  sudo port rebuild installed

To install a port run (where cppcheck is the port we want to install):

  sudo port install cppcheck

To upgrade old ports after running a selfupdate run:

  port upgrade outdated

To uninstall a port run:

  sudo port uninstall TeXShop

See the version of Mac Ports:

  port -v

Last Updated ( Friday, 15 November 2013 )
 
Format a drive in OSX with a FAT16 partition type PDF
Monday, 22 April 2013
If we want to format an USB stick for example in MSDOS FAT16 partition type from OSX terminal, first we will find out our drive name which will be formatted:

  diskutil list

/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *1.0 GB     disk1
   1:                    FreeBSD                         306.0 MB   disk1s1
   2:                    FreeBSD                         306.0 MB   disk1s2
   3:                    FreeBSD                         1.5 MB     disk1s3

To format our /dev/disk1 using fat16 we will run:

  diskutil partitionDisk /dev/disk1 1 MBRFormat "MS-DOS FAT16" "UNTITL" 1000M


 
Copy DVD Disk to an File From OSX Command Line PDF
Wednesday, 31 October 2012
Let's say you have a DVD that you want to backup and you've tried to copy files from it but some files cannot be copied because the DVD is cratched and it returns you read errors. If files that cannot be read entirely are video files you can still copy those file partially by ignoring read errors.

To copy/backup a DVD from OSX and ignore errors we will use dd command from OSX's terminal:

  sudo dd if=/dev/disk1 of=file.img bs=1m conv=noerror,notrunc

Last Updated ( Wednesday, 31 October 2012 )
 
Eject a DVD from OSX Shell PDF
Wednesday, 31 October 2012
If you want to eject a DVD from OSX command line (OSX's terminal) you can do it easely with hdiutil command:

  sudo hdiutil eject -force /Volumes/MY_DVD

To list your drives from OSX terminal run:

  diskutil list

 
Use a better terminal on OSX rather than default one PDF
Thursday, 22 March 2012
If you are a sysadmin and you need a better terminal app (better than Terminal) there's a usefull app called iterm2:

It's free. To install it go to: http://www.iterm2.com/

It's has more options than OSX's Terminal and you will notice your F-keys will work with Midnight Commander.

 
Configure OSX's wireless from command line PDF
Thursday, 22 March 2012
If you do not want to change your default settings from your wifi card but you want just to manually configure wifi from command line so next time when you restart your previous settings will be keeped do the following steps.

This is usefull to test/use a different wifi network for a while then reboot and keep your regular wifi settings.

1. Start terminal from Finder / Applications / Utilities / Terminal


2. Switch to root user with:

  sudo su
(you will need to input root password


3. Delete default route with:

  route delete default


4. Add an IP alias to your network wifi card

  ifconfig en1 192.168.1.100 netmask 255.255.255.0 alias


5. Add default route to new wifi router

  route add default 192.168.1.1


The setup works if you are previously connected to that router wifi. For example if you have an access point that connects you to multiple networks. Or if not, just connect first to this second Access Point and then run previous commands.

 
OSX to Samba Error, You don't have permision to rename PDF
Sunday, 12 February 2012
If you get the error:

  You don't have permision to rename

when you try to access a Samba resource on FreeBSD or Linux machine from OSX the problem is that you need to add the following line to your smb.conf file:

  unix extensions = no

If this does not solve the problem look for the name of your directory/file you want to rename. It might contain characters not supported by OSX to Samba conversion.

For example having a dir name with @ might give you that error. Like: @@@@this_is_the_folder_to_rename.

In that case the problem can be fixed by manually renaming the folder from your FreeBSD/Linux machine that hosts Samba and then do not use such characters anymore.

 
Fixing Rudix Apps Crash on Snow Leopard PDF
Monday, 06 February 2012
Let's say you want to run Midnight Commander (or wget or other app available usually on FreeBSD or Linux) on your OSX. You will install Rudix from Terminal and then Midnigt Commander (note that apps installed with Rudix are compiled for Mac and are not FreeBSD or linux binaries).

  Run Terminal in OSX and then from command line run:

  curl -O http://rudix.googlecode.com/hg/Ports/rudix/rudix.py
  sudo python rudix.py install rudix
  sudo rudix install coreutils
  sudo rudix install mc
  sudo rudix install wget
  sudo rudix install lynx


So you've installed Total Commander (or Wget or other app) for example using Rudix on Snow Leopard and when you try to launch one of those apps you get the following error:

  Abort Trap

The problem is that you did not installed some compatibility apps for Snow Leopard.

Just also install compat libraries:

  sudo rudix install compat-aria2
 
sudo rudix install compat-bzr
 
sudo rudix install compat_gettext
 
sudo rudix install compat_lua
 
sudo rudix install compat-mercurial
 
sudo rudix install compat-pip
 
sudo rudix install compat-pycurl
 
sudo rudix install compat-scons
 
For Midnight Commander you will need compat_gettext but just to make sure install all.

Also if you are using other version of OSX (Lion for example) don't forget to install libraries:

  sudo rudix install check
 
sudo rudix install pcre
 
sudo rudix install gmp
 
sudo rudix install lcms
 
sudo rudix install libev
 
sudo rudix install libevent
 
sudo rudix install libintl
 
sudo rudix install libjpeg
 
sudo rudix install libmemcached
 
sudo rudix install libpng
 
sudo rudix install lzo

I would also install all utilities:

  sudo rudix install check
 
sudo rudix install pcre
 
sudo rudix install gmp
 
sudo rudix install lcms
 
sudo rudix install libev
 
sudo rudix install libevent
 
sudo rudix install libintl
 
sudo rudix install libjpeg
 
sudo rudix install libmemcached
 
sudo rudix install libpng
 
sudo rudix install lzo

 
sudo rudix install asciidoc
 
sudo rudix install aspell
 
sudo rudix install cabextract
 
sudo rudix install coreutils
 
sudo rudix install dialog
 
sudo rudix install dtach
 
sudo rudix install findutils
 
sudo rudix install mc
 
sudo rudix install optipng
 
sudo rudix install rudix
 
sudo rudix install tmux
 
sudo rudix install xz

There is the wiki page for Rudix apps: http://code.google.com/p/rudix/wiki/Packages

Last Updated ( Monday, 06 February 2012 )
 
Convert ISO file to DMG file or convert DMG to ISO file PDF
Thursday, 19 January 2012
It is possible in OSX to convert a file from DMG format to ISO format or viceversa.

To convert from ISO to DMG run in OSX's Terminal:

  hdutil convert in_file.iso -format UDRW -o out_file.dmg

To convert an image file from DMG to ISO run in OSX's Terminal:

  hdutil convert in_file.dmg -format UDTO -o out_file.iso

Note: Before converting make sure your in_file is ejected (not mounted).

Last Updated ( Thursday, 19 January 2012 )
 
Compile an XCode Project from Command Line PDF
Friday, 25 November 2011
You can compile any XCode project from Terminal's command line using xcodebuild.

Run from command line:

  xcodebuild

And it will compile the project from current directory.

On successfull compilation you will get:

** BUILD SUCCEEDED **

Last Updated ( Friday, 25 November 2011 )
 
Get Attributes of Files and Directories in OSX PDF
Friday, 25 November 2011
You can get attributes of files and directories in OSX using GetFileInfo tool. For example you can see if a directory is a bundle for an app in OSX using GetFileInfo tool from Terminal command line:

  GetFileInfo /Applications/iMovie.app

You will get:

directory: "/Applications/iMovie.app"
attributes: avbstclinmedz
created: 07/08/2011 18:52:51
modified: 07/26/2011 14:13:48

Last Updated ( Friday, 25 November 2011 )
 
Selecting Multiple Files with Midnight Commander under OSX PDF
Wednesday, 23 November 2011
If you want to select multiple files in mc (Midnight Commander) under OSX you will notice your insert key is not working (or you do not have an insert key). To select multiple files in mc you can use Ctrl + T shortcut.

 
Burn an ISO file in OSX from Command Line (Terminal) PDF
Thursday, 17 November 2011
There's an easy way to burn .iso files in OSX right from command line using hdiutil:

  hdiutil burn file.iso

 
Resize an OSX Partition From Command Line (Terminal) PDF
Thursday, 17 November 2011
If you want to resize an OSX partition from command line (terminal) here's how to do it:

  sudo diskutil resizeVolume /dev/disk1s2 100GB

Where /dev/disk1s2 is the partition you want to resize.

If you want to see how much can you decrease or increase the partition size run:

sudo diskutil resizeVolume /dev/disk1s2 limits


 
Disable Spootlight Indexing in OSX PDF
Thursday, 17 November 2011
If we want to disable Spotlight indexing process that is currently running we run from command line:

  sudo mdutil -i off "/Volumes/Macintosh HD 1"

Where '/Volumes/Macintosh HD 1' is the path to our volume that is being indexed.

This is usefull for example if you do not want to index an external hard drive.

 

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?