Twitter Updates

Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Saturday, 23 January 2010

VMware Fusion Disk Usage

The disk images for the operating systems are sparse, i.e. they expand as necessary. They unfortunately do not shrink automatically when you delete data.

For a windows image you have to install the VMware tools to shrink the disk.
VMware guide
http://www.vmware.com/support/ws5/doc/ws_disk_shrink.html


The VMware Tools are installed by: Start your virtual Operating system -> Move mouse to the top of the screen and select 'Virtual Machine' -> 'Install VMware Tools'

VMware Tools location
C:\Program Files\VMware\VMware Tools\VMwareControlPanel

Monday, 14 December 2009

Problems with Snow Leopard and Ruby Gems

UPDATE 2 (update 1 at the bottom with some extra ruby version info)
When you install Xcode make sure is is the latest version. I must have at some point installed the old Leopard version. then when things did not work reinstalled that same old version. I found xcode321_10m2003 in my downloads folder not the older one I had put in a software folder. You may still need to update Ruby to a new version.

Make sure you have the latest Xcode.


I have been trying to get the very simple Sinatra (a light ruby on Rails) setup working following the verysimple instructions on http://www.sinatrarb.com/

Make a file called hi.rb with this inside:
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end

Then run these commands:
$ gems install sinatra
$ ruby hi.rb


They fail with:
hi.rb:2:in `require': no such file to load -- rubygems (LoadError)
from hi.rb:2

After removing the require 'rubygems', is it actually still required ?
hi.rb:3:in `require': no such file to load -- sinatra (LoadError)
from hi.rb:3

To fix this I ran through the instructions at http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/

Their instructions worked well until the mysql gem which I do not require at the moment but do like to get my set up the same as the tutorial. I found the following line on stackoverflow.
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysqlplus


Finally got the basic sinatra working by calling:
$ /usr/local/bin/ruby hi.rb
Even though which ruby returns /usr/local/bin/ruby, so why does ruby hi.rb not just work!

What is going on just thought I would check to see if calling the other ruby breaks it, but it works fine.
$ /usr/bin/ruby hi.rb


UPDATE
For completeness and to answer Spyro7's Question:
$ /usr/local/bin/ruby -v
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.2.0]

$ /usr/bin/ruby -v
> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

Sunday, 13 December 2009

Rediscovering Airfoil

Apple produces quite a cheap way to stream audio into another room/Hifi all you need is an airport express plug it into an amp or a powered set of speakers then iTunes can transmit over wifi to these external speakers.

There is a nice piece of software called airfoil by rogueamoeba which is available for $25 (25 us dollars). It allows you to stream certain application or all audio to these external speakers. You can also select which speakers to transmit to.

There is a new application which I have not seen before, Airfoil Speakers this allows a Mac or Windows PC to be turned in to a receiving Airport express!

There is also an Airfoil Speakers for the iPod Touch! So you get wireless headphones capability

Thursday, 10 December 2009

Mac OS X NTFS Drivers speed test

I have had to transfer some data from one USB NTFS formatted drive to another USB NTFS formatted drive. These are the results using the different Mac NTFS drivers available.

NTFS-3G (With MAC FUSE) Caching disabled:


NTFS-3G with caching enabled:


Tuxera NTFS for Mac (25 Euro) (based on NTFS-3G) Caching enabled:


Also missing, For comparison HFS+ test:







NTFS-3G (No Caching) 183 MB/Minute
NTFS-3G (Cached) 610 MB/Minute
TUXERA (Cached) to HFS 1000 MB/Minute
TUXERA (Cached) 1223 MB/Minute
NTFS-3G (Cached) to HFS 1391 MB/Minutes
HFS+ SATA to USB 1464 MB/Minures

Wednesday, 9 December 2009

Mac OX Speed test your (USB) Hard Drive

Just tried xbench to speed test my harddrives, very surprised that it still works as it looks like the last time it got any updates was for OS 10.3 a few years ago.


http://www.xbench.com/


The Results from my main Hard Drive Mac OS X:


Aaargh, it refuses to test USB drives the only reason I was trying it out!

Saturday, 5 December 2009

Snow Leopard Get Summary

OS X has a very use shortcut for getting info on files which is cmd-i or the 'apple key' and 'i' will bring up an info window. If you select more than 1 file you get an info window for each! probably not what you wanted.

On OS X 10.6 if you hold down the control 'ctrl' key as well as cmd-i (ctrl-cmd-i) then you get a neat summary of those files. Very useful for getting the disk spaced used by multiple files.

if only one file is selected ctrl-cmd-i and cmd-i perform the same function, why is ctrl-cmd-i not the default!

If you would like to have a multiple file summary by default try this:
Open your system preference is your usual way, I use quick silver so just pres ctrl-space type sys and enter.

Go to the Keyboard item. Key board shortcuts then press then plus in the bottom left of the main panel.

Add a shortcut for application finder. command is 'Get Summary Info' then in the keyboard command type the shortcut you want, in this case cmd-i.


NB: You may also need to uncheck the Show Info option in Keyboard shortcuts->Service->Files and Folders->Show Info.

Wednesday, 28 October 2009

Hugin for panoramas

hugin seems to be quite a good open source program for joining photos together for panoramas etc.

My first attempt joining 3 photos.
morganp-20091028-Hugin-3-EdinClouds

Friday, 2 October 2009

Some tips for ~/.inputrc

If you use the command line alot on Unix, Linux or Mac (I know it is a unix) you might be interested in some options that you can set in your ~/.inputrc file.

If the file does not exist you can just create it.
$ cd ~
$ vim ~/.inputrc

My favourite option is (just enter it any where in the file):
set completion-ignore-case on

This makes tab completion non-case sensitive, since discovering this I have cut down massively on the amount of backspace I have to type to get the tab completion I wanted.

Another option that may be useful is:
set match-hidden-files off

Which stops tab completion using hidden files, but since I edit my .bashrc .inputrc etc alot I often do want to tab complete hidden files.

For more info on options just have a look at:
man readline

Wednesday, 16 September 2009

New NTFS driver for Mac OS X

There is a recent driver out for Read/Write support of NTFS drives under Mac OS X.
Download

There is now an NTFS-3G item in the system preferences. I would recommending unchecking the "File system Caching enabling". This with disk caching the mutliple read writes to the same data can be much faster but can corrupt the disk if the buffer is not flushed before removal. Ejecting or unmounting the disc is the way you tell the computer you want to flush the buffers and remove the disk. BUT I occasionally forget to do this for external discs and I dont want to lose all my data. On the plus side I do not work (edit data) on external discs just transfer/Archive data or play/read files so I do not see any performance loss.

The new driver also has a force button for when windows did not shut it disc down correctly. So you can force OS X to load the disc any way, this was a real pain in my old version of the driver.

Release Notes Updates can be found here:
http://macntfs-3g.blogspot.com/

Saturday, 12 September 2009

Make Audiobooks

I have recently got some audiobook CDs and have been looking for the best way to convert them for use with iPods. iTunes (Apple) have defined a special format for Audiobooks, it is the *.m4b format. It is really just the m4a format but with last a for audio changed to b for books. This Format uses AAC, quite superior compared to the mp3 codec but not as portable.

When imported the m4b format should automatically be set to book-markable or remember position. When listening to music you normally want to start at the beginning of the song, when listening to a book you normally want to start from exactly the same position you left off.

I found the best method for me is to convert all CDs into Wave files, as the best tool available rencodes into the AAC format and you do not want to do lossy conversion more than once as the audio quality will degrade. Once you have got all your wave files together I recommend using Audiobook Builder ($10 paypal, then auto-email codes to you).

With Audio Book builder I normally change the genre to 'Audiobook', search amazon for an image of the book cover and have to add the year manually in itunes, itunes does then update the file.

[Note added 03/03/2010]
Audiobook Maker does not look like it is compatible with Snow Leopard
[/Note]
If you already have a bunch of MP3s this tool is free Audiobook Maker (only imports MP3s) and then converts to m4b, but you are doing conversion to mp3 then to aac so you get two types of conversion loss, probably do not notice with speech though.

Quicktime X playing avi

I have just installed DivX 7 (thought they were upto 10 but never mind) on OS X Snow Leopard and it seems to have given me all the codecs to play DivX XviD encoded media. This did not work last time I tried. The trim function in the new quicktime even works although have to export to either .mov or .m4v.

http://www.divx.com/en/mac

NB: I still recommend VLC as the best player for Mac OS X

Thursday, 10 September 2009

Omni Disk Sweeper

Just tried Omni Disk Sweeper for identifying large files eating up my disk space. It is very easy to use and just spotted 20Gigs of file I do not need and had forgotten all about.

http://www.omnigroup.com/applications/omnidisksweeper/

Monday, 31 August 2009

Recursively Search for file with text

Using the find command below in Unix/Linux/OS X terminal you can search from a given path recursively looking in all files for text that matches 'find this text'.

$ find ./searchPath/ | xargs -I {} grep -iHn 'find this text' {}

or

$ grep -R -iHn 'find this text' *

grep Options:
-i makes it incase sensitive
-H outputs the filename before the matching line.
-n outputs the matching line number before the matching line.
-R Recursive from current location

[UPDATE 1]
Ignore Subversion folders
$ find ./ -not -name *'.svn'* | xargs -I {} grep -iHn 'find this text' {}

Monday, 3 August 2009

Easy Create DMG Files with background images

I just discovered this [1] helper application for creating DMG file for distributing your Mac Applications.

[1] iDMG http://www.nscoding.co.uk/

Easily define Icons and Background images.

Thursday, 30 July 2009

Create Icons *.icns for OS X

To create icons for your OS X Applications, first create a master 512pixel x 512pxel master image. create smaller versions if required ie if you want the smaller logos to be different.

The size options you can create for are:
512x512
256x256
128x128
32x32
16x16

Once you have your images, my logo is simple so I only created one 512 master copy, from photoshop save as a tiff with transparency and Image compression:no compression, Layer Compression:discard all layers and save a copy.

Then open (you need the developer tools xcode):
/Developer/Applications/Utilities/Icon Composer.app

Then drag you 512x512 tiff on to the largest square I then let it auto scale this image for the smaller options. Then just go File Save As. and you *.icns file is created.

A very helpful tutorial was.
http://tutorialdog.com/how-to-create-icons-for-mac-os-x/

A generic guide to integrating the icns into your mac app is:
http://stackoverflow.com/questions/646671/how-do-i-set-the-icon-for-my-applications-mac-os-x-app-bundle

Because I am working on a project setup by xCode I can just replace the file in:
ProjectRoot/resources_macosx/projectName.icns

Sunday, 19 July 2009

Mac OS X and sshd

To ssh into a mac you need to turn this service on which is very easy.

From the terminal (/Applications/Utilities/Terminal.app)
$ ssh localhost
>ssh: connect to host localhost port 22: Connection refused

Now go to '/Applications/System Preferences.app' -> 'Sharing' then enable 'Remote Login'
Sharing

Now Try ssh again:
$ ssh localhost
Password:
Last login: Sun Jul 19 16:31:39 2009 from localhost
$

OSX eat my GNU

Trying to setup snapback2 bbackup software but started running into issues because the os x commands are based on the BSD variants not the more standard GNU versions used on most Unix's and Linux's.

Tried some manual installs but eventually after hitting a few dead ends found the package in port (mac ports formerly darwin ports).

1) Assuming Mac Ports is already installed (if not do that first, to tired to give instructions for that)
2) $ sudo port install coreutils
NB: since os x 10.5 sudo only works if you have a password set.
3) Get that pesky BSD cp out the way
$ sudo mv /bin/cp /bin/cp-osx
4) link to the new shiny GNU
$ ln -s /opt/local/bin/gcp /bin/cp

5) test old version
$ cp-osx --version
>/bin/cp-osx: illegal option -- -
>usage: cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file target_file
>cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file ... target_directory

Note The excellent handling when requesting the version!

6) Now the new version:
$cp --version
>cp (GNU coreutils) 7.4
>Copyright (C) 2009 Free Software Foundation, Inc.
>License GPLv3+: GNU GPL version 3 or later .
>This is free software: you are free to change and redistribute it.
>There is NO WARRANTY, to the extent permitted by law.
>
>Written by Torbjörn Granlund, David MacKenzie, and Jim Meyering.

This can be repeated for any other GNU commands you would like to map from /opt/local/bin/ to /bin. Most are prepend with g but if it is a 3rd party script that you are trying to get working it is often easier to make the default the gnu version.

Saturday, 18 July 2009

CocoaDialog DialogBoxes for scripts

I just discovered CocoaDialog, this allows scripts (Ruby, Perl, Bash) to ask for user input in a pretty way. Will be useful for creating double click runnable script/programs

Download .dmg and copy CocoaDialog.app to /Applications/

test run from bash terminal (/Applications/Utilities/Terminal.app)
$ /Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog standard-inputbox --title "Your Name" --informative-text "Enter your name"

Example should show this:
CocoaDialog-standard-inputbox

Pressing ok will return:
>1
>enteredText

Pressing cancel will output:
>2

Friday, 17 July 2009

Setting up Time Machine on any NAS

Start by opening the Time Machine option pane, "/Applications/System Preferences.app" then choose Time Machine under "Systems"

I would also like to point out something I find very odd which is that Time Machine needs to target a particular partition (Drive letter in windows speak, or volume in mac speak). So for a network drive I would create a new network share called timemachine_computerName

[ADDED 20/07/2009 ]
Most of the following is to setup the new network share so that it will work with time machine. I have program TimeMachineAnyNetworkDrive which will setup most of this for you. then just copy the sparsebundle from your home directory to the networkshare and try time machine again.


First problem is apple does not allow any NAS (Network attached storage) device to be used by default, only their premium priced time capsule!

01NO-NAS

To allow non-apple network drives run this command (from the terminal):
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

02NAS_ALLOWED

Selected NAS but after first attempt the backup fails.
03-NAS-DENIED

What we need to do is create a sparse dmg which gives timemachine all the required file system functions on any filesystem. For this we use the hdiutil command.
NB: The hdiutil command will only work on local (internal and external) drives not network drives.

So we create the sparsebundle (dmg) locally then copy to the remote drive, when copied through the command interface I got a few errors so I copied through finder (graphical interface).

The Sparse bundle name needs to be computerName_MAC.
All the following are typed from the terminal (/Applications/Utilities/Terminal.app) $ inputs > output from the terminal.

To check the computer name you can just run:
$ hostname -s
> Queeg500

The Mac address of the first wired port EN0 is normally used. Every network socket/wifi will have its own MAC. To find your MAC

$ ifconfig en0 | grep ether
> ether 00:1b:63:a6:7e:5b


Sparsebundles takeup only the size of the data they contain, but the size property limits the maximum size. Here we limit to 200Gigabytes.
cd ~
hdiutil create -verbose -size 200g -fs HFS+J -type SPARSEBUNDLE -volname "Backup of Queeg500" Queeg500_001d4ffac84b.sparsebundle
#may be better to move graphically
mv Queeg500_001d4ffac84b.sparsebundle /Volumes/timemachinetest/


Then try the timemachine backup again.
04NAS-WORKING


Very good article here.

Applescript What Property?

My apple script (applescript) just made a massive leap forward or at least my unerstanding of how people go about figuring it out. I never could work out how people new what all those scriptable properties where called until now.

Open Script Editor (/Applications/AppleScript/Script Editor.app) may be open a script you have been writting / downloaded.

The really clever bit:
from Script editor File-> Open Dictionary
Now choose the application you are scripting and you will get a browsable searchable list of properties that the script can get and set!