One of the powerful features of OS X built-in spotlight is its ability to search the contents of files for your search string.. However, for reasons yet unknown, I have found this functionality to sometimes be a little hit and miss..
Which is where Terminal comes in.. Using a single line terminal command OS X will rapidly return all the files containing the text you are looking for.
First of all, for this example you need to first set your current path in terminal to the folder containing the files you want to query.
Then type/copy & paste the following
So for example, should you want to find all the text files containing the word AppleScript, you would use the following command:
To expand of the example above, should you want to extend that and search sub folders all you need to do is add ‘r’ for recursive:
This will now return all text files in the folder and subfolder containing the term AppleScript.
I recently came up against a bit of an issue whilst working on my MacBook Pro in the office, due to the environment we work in access to the outside world is tightly controlled by our firewall, and although I love to spend countless hours adding and tweaking rules (not strictly true) – I wanted to find a better solution for routing traffic to certain sources over certain connections.
Now – there’s a couple of fairly major caveats on this ‘how-to’ and that is that a second network needs to be available and that the gateway addresses are different.
For the purposes of this tutorial, my wired lan connections IP address is 10.0.0.1 and my wireless connections IP address 192.168.2.2.
The tutorial was born from my laptop’s need to communicate with Stanford Universities Folding@Home client, which needed to communicate with its job server 188.8.131.52* to upload and download new work packages. (*This is one IP address of many used)
Knowing I had my unrestricted wireless connection available I knew I wouldn’t have any issues, however as my MacBook’s service order is always set to use the cabled connection first – the client would always try sending over that and then fail.
Working around this is however, fairly straight forward and easy to achieve. All I needed to do was to direct all the network traffic to Stanford’s servers over my wireless connections gateway.
To do this, all you need to do is fire up a terminal session and type the following:
Sudo route add184.108.40.206192.168.2.1
Upon hitting return you should be prompted for your ‘sudo’ password, once added the route will then be added to the routing table. Thus forcing all traffic to that address to ignore my service order, and default to the wireless connection to send/receive traffic. Obviously – this is a pretty unique situation, and outside of that network traffic will then start failing. To rectify that, and remove the entry from the routing table you will again need a terminal session, and to type the following:
Sudo route delete220.127.116.11
Obviously you will need to replace the IP Addresses where appropriate.
If you’ve a better way of dealing with such issues I would really be interested to hear them – let me know using the comments section below.
Traceroute is an important part of any IT experts toolkit who’s worth his salt.. Traceroute enables you to track down potential routing issues between your Mac/PC/Device to your Router/DNS Servers/Web Host.
If, like me you migrated over to Mac from a PC, you will be used to launching a command prompt and firing off the tracert command. However, in OS X the command is slightly different. Some may say it makes more sense..?
To use OS X Traceroute you need to launch a new terminal session, to do this open Applications > Utilities and click terminal.
When the terminal has launched simply type Traceroute followed by the address you want to trace the route to. So for example, if you wanted to check how your devices browser gets to Google.co.uk you would type:
Your mac will then resolve Google.co.uk to it’s IP address, and then trace each ‘hop’ from your device to the address. This can be very handy when trying to figure out if the routing issue is your equipment, your ISP’s equipment or the web host it’s self.
I came up against a bit of an issue today, I realised my Xcode was stuck on version 4.1 and the AppStore wasn’t detecting the update available to v4.2. Now normally this wouldn’t be an issue, however version 4.1 doesn’t include the iOS 5.* SDK’s.
So I decided the only way around the issue, would be to completely remove the old version, then install the fresh version 4.2 straight from the AppStore.
TimeMachine has saved my ‘bacon’ on many an occasion. However, when trying to stream movies over wireless in can sometimes get in the way, and cause the film to stutter whilst it backs up.
Now, the easy way around this is to disable TimeMachine before you start your film, and then start it again afterwards. However, if like me you forget to do so – and you Mac is set up for SSH access, you can do this easily via your phone.
SSH into your Mac, logon with your credentials and run the following command: