PREVIOUS NEXT
Mac OSX: Burn an ISO image to cdrom from command line
The command line is trustworthy, dependable and clean.. GUIs are slow and cranky. This recipe desribes how to burn an ISO image from the command line on a Mac. Yeah, there's a GUI way to do this, but you can be burning the disc before that GUI starts up.Given an ISO file (image.iso, for example) in the current working directory, use the following command to burn it to a disc that you've inserted into a recordable drive:
hdiutil burn image.iso
Editor Note:
Typo Corrected.... Read More
Safari: How to Clear the Google Search Box History
Prevent people from seeing what you have previously searched for. Erase your google history in safari.Two easy solutions exist to this problem.
Reset Safari:
This just doesn't erase your google data, it erases your cookies, autofills, cache, history list, usernames, and passwords.
1. Goto the Safari menu
2. Click Safari
3. Select Reset Safari
Clearing Just Your Google History:
1. Goto the Safari Menu
2. Select Preferences
3. Select Autofill tab
4. Select the Edit button from the Other Forms Line
5. From the AutoFill list of sites select Google.com
6. Select Remove
7. Select Done... Read More
Mac OS X right click single button mouse
A stumbling block for those souls who have been reared on Windows systems but have seen the light and moved to a Mac is the single button mouse. But wait, there's no need to rush out and buy a two-button mouse just for this.To simulate a right mouse button click while using a one-button mouse on a Mac, like to get a context sensitive menu for an object on the screen, hold down ctrl and click the mouse button while your mouse pointer is over the object.... Read More
Mac OS X change the terminal window title
The title of the Mac OS X terminal window can easily be changed. This can be useful when running a script or when using multiple terminal windows for different purposes to easily identify them when switching between applications and windows.In the terminal window, from a bash prompt (the default shell) or in a bash shell script, use the following command to change the terminal window title to Tech-Recipes rules:
echo -n -e "\033]0;Tech-Recipes rules\007"
You can place (just about) any text in place of Tech-Recipes rules including the contents of a variable. For example:
name=`hostname`
echo -n -e "\033]0;$name\007"
This will change the title of the terminal to the hostname of the computer running the shell.... Read More
Mac OS X command line tab completion
The command line completion feature is turned on by default on Mac OS X systems, you only need to know how to use it.When typing a command in the shell of a terminal window, you can simplify your life with the file/directory tab autocompletion feature. Consider that the current directory contains these two directories: Backup files, and Books. If you want to switch into the Backup Files directory, type:
cd Ba<tab>
where represents the tab key. Note that if you just type cd B there is an ambiguity since there are two matches. In this case, the shell will list the matches and return you to the same command line state as before you typed the tab key.
A common problem in using command line interfaces on systems with graphical interfaces is that spaces in filenames, while simple in a GUI, complicate things in a command line because shells typically use a space to separate command line parameters. The shell is smart enough to place a backslash before a space in the subsequent autocompl... Read More
Mac OS X recover lost root password
For the sake of security, recommendations say to have unique, complex passwords. Most people have a hard time remembering these and will eventually forget one. Forgetting the root password on a Mac system can seem devastating, but this recipe will show an easy way to recover.If you have the password to an account that is an administrator on the system, then it is easy to recover the password using the sudo command. Open a terminal window and type:
sudo passwd root
and you will be prompted for your password (the user account that you do remember). Then you will be prompted for the new root password twice. That's it!
The sudo command is a wonderful way to control who can do what on a system. In this case, since the user account is considered an administrator, the sudo command allows you (after confirming that you are who you say you are with the user password) to run a command as if you were root. The command we are running is passwd root which is the command to change the password for t... Read More
Mac OS X increase or decrease a web browser font size
Some web pages may use a font size that doesn't render properly in different browsers on various platforms. If you find yourself squinting at a web page, this simple keyboard shortcut can help.To increase the font size of the current web page, press command + by holding down the command key (with the apple and the squiggly) and pressing a plus key (no shift required).
To reduce the font size, press command - (command and minus).
I've tested this with Safari and Firefox. It may work with other browsers and applications.... Read More
Mac OS X AirPort connection with non-Apple wireless router/gateway
Need your Mac and non-Apple wireless router to peacefully coexist? Out of the box, my iBook didn't work with my Motorola broadband router. This recipe describes the steps taken to make the two play together.I had an existing Motorola wireless broadband router configured with 128-bit WEP using a preshared key. The iBook saw the ssid and accepted the key and let me know that it made a connection to the router, and the router saw the MAC address of the iBook, but I could not ping the router or get anywhere outside of my laptop tpc/ip stack.
After trying many settings, I discovered that changing the router to use WPA-PSK (Wi-Fi Protected Access - Pre-shared Key) and TKIP encryption status allowed my iBook to work and happily send packets to and fro. On my router, this involved logging into the router admin web page, clicking wireless on the left panel, then clicking the security tab. Under ESS Authentication, select WPA-PSK and for Encryption Status pick TKIP. Type a pass key (alphanumeric... Read More
Mac OS X Join a Windows workgroup
Mac OS X has built-in capablities through Samba to play nicely with Windows networks. An early step to working seamlessly with a Windows workgroup is joining that network.Open the Directory Access utility (under Applications -> Utilities).
If the window is locked (padlock closed on the lower left), click on the padlock to unlock it.
Select SMB and click Configure...
Type in the name of the desired Windows workgroup in the Workgroup field, enter a WINS server (if appropriate) and click OK, then Apply.... Read More
Mac OS X connect to a Windows file share
Can't we all just get along? Macs and Windows can since Mac OS X includes Samba. Once you have configured the Windows workgroup on your Mac, you can connect to a Windows share by following these steps:
Click somewhere on your desktop to bring up the Finder menu at the top of the screen.
Click the Go menu at the top of the screen and select Connect to Server...
In the Server address field, to connect to the Windows server at 192.168.1.15, use:
smb://192.168.1.15/sharename
The sharename is optional. If omitted, the system will prompt you with a pulldown menu of possible shares. If asked to authenticate, use the username and password of the Windows system to which you are connecting.... Read More
Mac OSX: Delete a user account
Deleting a user account is neat and clean with Mac OS X. This recipe describes the procedure and consequences of deleting a user.To delete a user, click System Preferences, then Accounts and select the user to delete. Click on the minus sign under the Login Options button, authenticating as the administrator if needed.
When a user is deleted in this manner, the contents of the user's directories are stored in a disk image (/Users/Deleted Users/userid.dmg). This file can be deleted (by an administrator) or kept (just in case).... Read More
Mac OS X gain root/superuser access using sudo
The command line utility sudo is a wonderful way to provide fine-grained access control to different applications to different users. In this recipe, sudo will be used to easily gain full root/superuser access to a Mac running OS X.Under Mac OS X, the root or superuser account is not enabled following installation. While it is possible to enable the root account, it is safer and potentially easier to use the sudo command to gain root access to the system.
From a terminal window, type
sudo -s
This will prompt you for a password which is the user's password, not the root password (which will not be set). The first time you run sudo, it will print a conscience-oriented message before prompting for the password. Subsequent uses of sudo for that user will not print out that text. The -s option launches a shell as the target user (root). When successfully executed, the shell's prompt should end with root#.
When done with root privileges, it is a good idea to demote yourself and return to you... Read More
Mac OS X enable fast user switching
Mac OS X is a UNIX-based operating system with all the cool bells and whistles. One of the big differences is that UNIX is a multiuser environment allowing multple users to be logged in at the same time. Mac OS X takes swapping between users to a funky new level with a feature called fast user switching. This feature is turned off by default.To turn on fast user switching, open the System Preferences and click on the Accounts icon under the System category. Click on Login Options near the lower left and click the Enable fast user switching checkbox.
The menu bar at the top of the screen will change, inserting the current user name at the top right. When you click on this name, you'll see a menu listing all of the system's users and a Login Window... choice. Clicking on a user's name will switch to that user (possibly after requesting a password). Clicking on the Login Window... option will take you to the login screen.
The fast user switch occurs with a dramatic rotation of the screen,... Read More
Mac OS X change the default web browser
Changing the default web browser in Mac OS X, especially 10.3, can be confusing. This recipe describes one simple method for changing the default browser.Start Safari (the standard browser).
Select Preferences... from the Safari menu.
In the General tab, find the Default web browser pulldown menu and make your selection from the list.
Close the preferences window (red x) and you're done!... Read More
Mac OS X monitor messages during boot
The graphical booting process is pretty, but there are times we want to see what is happening to the system while it boots. This can be particularly beneficial when troubleshooting problems.To view the boot messages for the current boot only (and return to the graphical display on the next boot), press command-V while the system is booting. The command key is the key with the apple and looping squiggly symbols typically next to the spacebar.
To make this change to the system permanent, you must make a simple firmware setting change. This is easily done using the nvram command and the sudo authentication system from a terminal window:
sudo nvram boot-args="-v"
To turn off this feature, use:
sudo nvram boot-args=
The nvram sets and queries the firmware settings. To display all of the settings and their current values, use:
sudo nvram -p... Read More
Mac OS X install gcc compiler
Compiling open source projects typically requires a C compiler and gcc is typically the compiler of choice. Mac OS X doesn't install the gcc compiler by default but it is freely available in the xcode suite of development tools.To install the gcc compiler, download the xcode package from http://connect.apple.com/. You'll need to register for an Apple Developer Connection account. Once you've registered, login and click Download Software and then Developer Tools. Find the Download link next to Xcode Tools (version) - CD Image and click it!
Find the downloaded package, doubleclick it and follow the installation instructions to install gcc and a host of other development applications. gcc will be located at /usr/bin/gcc.
Websites tend to change over time, so if you notice that the steps to download xcode have changed, please post a comment and I'll update the recipe.... Read More
Copy music files from your ipod using only the command line.
Copying files from your iPod to your Apple system is easy. Here are the commands.After seeing a recent tutorial on copying files from your iPod to your PC, I wanted to show Apple users that it is pretty easy to copy files from your iPod as well. That's actually a pretty interesting tutorial for both Apples and PCs so check it out.
His instructions for apple, however, were pretty thin. Here is what you need to know to copy your music files from your ipod to your apple.
1. Open a terminal window
2. Run the following type of command:
cp -R /Volumes/ipodname/iPod_Control/Music local_music_path
where:
ipodname = the name of your actual iPod
local_music_path = path on your Apple you want to copy your files to
Here is what I run on my system.
cp -R /Volumes/mickmPod/iPod_Control/Music /Users/mickm/Music
3. Wait while the files are copied over to your system. A new line prompt will appear when it has completed. You will see a bunch of numbered folders in your local_music_path.
4. See this tuto... Read More
Convert Mac OSX DMG CD or DVD image to ISO format to burn on Windows
If you download a DMG file and need to write it to a CD or DVD but don't have the necessary drive on your Mac, you can convert it to the Window's friendly ISO format using the hdiutil command.The hdiutil command is only available in Mac OSX so these steps must be performed on the Mac side, not on a Windows host.
Open a terminal window (Finder -> Applications -> Utilities -> Terminal)Given the disk image image.dmg in the current directory, it can be converted with:
hdiutil convert image.dmg -format UDTO -o image.iso
This will actually create a file called image.iso.cdr in the current directory (even though we asked for the output to be image.iso). This file can be safely renamed to image.iso, copied to a Windows server, and burned with your CD/DVD burner of choice.... Read More
OS X: Screenshot Shortcuts
Taking screenshots in OS X is very simple. Here are the shortcuts to do it.
Command+Shift+3 Capture entire screen and save as a file
Command+Control+Shift+3 Capture entire screen and copy to the clipboard
Command+Shift+4 Capture selected area and save as a file
Command+Control+Shift+4 Capture selected area and copy to the clipboard
Command+Shift+4 then Space bar Capture window, menu, desktop icon, or menu bar and save as a file
Command+Control+Shift+4 then Space bar Capture window, menu, desktop icon, or menu bar and copy to clipboard... Read More
OS X: Play Movie As Background of Desktop
Microsoft has recently released released dreamscene which allows users to run a movie file as the desktop background. High quality free video software will do this for mac as well.Although not friendly to the CPU, running a movie as a background is natural in certain environments. I love working with some of my old favorite movies or music videos playing along. I usually would do it in a window; however, having it as the background is one step better.
On OS X, it is pretty easy. I use the free divx player.
1. Download and install the divx player
2. Load the movie clip
3. Click Playback menu
4. Select Desktop... Read More