Category Archives: OS X

Evernote search in Spotlight fixed!

I have used Evernote for several years and I recently purchased a new MacBook with OS X Mavericks.  I set all my software as normal and found Evernote in the App Store.  I downloaded and installed, and my notes populated as normal.  A few days go by and I notice I can’t see any Evernote notes in my spotlight search.  I remember it used to work on my old mac, why not this one?  I searched around a bit online and decided to open a ticket with Evernote.  I thought being a premium subscriber, I’d get quick support and get this resolved asap.  Not the case!   I opened a ticket on 4/11/14 – and still haven’t gotten resolution after multiple back and forth with support.  Their suggestion was to re-index my Mac.  This did not fix the problem.  I was convinced it was an Evernote issue, not a Mac / spotlight / indexing issue.

After my frustration with Evernote support – I started searching the forums and came across this:   The issue was with the App Store version of Evernote.  The fix was to completely remote Evernote using steps below and reinstall using the manual download from the Evernote site:

1.  Close any web browsers with Evernote plugins:
* Close Safari
* Close Firefox
* Close Chrome

2.  Ensure that the Evernote Helper is not running
(It is not sufficient to reboot the system if the Evernote helper is set to restart on login)

In a terminal session:

  • ps alwwx | grep -i evernote
  • Kill the process “EvernoteHelper”

3.  Remove the following files
(This may require root privileges – as ‘sudo’)

  • sudo rm -rf /Applications/
  • rm -rf ~/Library/Application Support/Evernote
  • rm -rf ~/Library/Preferences/com.evernote.Evernote.plist
  • rm -rf ~/Library/Preferences/com.evernote.EvernoteThumbnailer.plist
  • rm -rf ~/Library/Preferences/com.evernote.SafariClipperPlugin.plist

4.  Download and reinstall Evernote from the Evernote website as normal.
5.  Login with your account and you are back in business.  Spotlight will now be able to search your Evernote notes!


How to Create a Time Machine Backup to a Network Drive

Let’s say you have a home NAS (Network Area Storage), a router with a hard drive, or even an old Windows machine with a lot of disk space lying around. You want to make use of this disk space to store your Time Machine backups. You open Time Machine Preferences and the only way you can add a non-local disk is via a Time Capsule or AirPort-connected storage. Now what? If this is your problem and you have upgraded to Mac OS X Lion, there is a workaround… Keep reading.
The reason why Time Machine Preference Pane doesn’t show network drive is likely the Mac Developer’s mantra: keep simple things simple and complex things possible. Novice users, by definition, are inexperienced — they’re likely haven’t gone through the pain of losing data and discounted the value of backups. Thus to not complicate things more and make it easy for most users (especially novices) Time Machine’s preferences only cater for the two common cases:
  • Directly-attached external storage (via USB, Firewire, or Thunderbolt).
  • Time Capsule or Airport Base Station attached storage.
But with Mac OS X 10.7, Apple have now made more advanced cases possible. As with most advanced stuff, you will need to open up Terminal to do it. The secret? The new tmutil command.
Back to the HOWTO. In order to create a Time Machine backup on a network folder  you need to follow these three steps:
  1. Create a HFS+ disk image, preferably sparse disk image, and place the disk image file into its destination folder/server where it will live. It shouldn’t matter whether it is SMB (Windows) or AFP (Mac) shared folder as long as your Mac can write to it.
  2. Mount the disk image and use the tmutil command to tell where is it. Make sure that the disk image is in it’s permanent home before you use tmutil (Also, don’t change the server name or shared folder name after Time Machine use it as your backup volume).
  3. Tell Time Machine to start the backup process to make sure it works.
Still not clear? Here comes the walkthrough

Creating the Disk Image

  1. Open Disk Utility
  2. Click on New Image
  3. Set a large enough size for the disk image. Ensure that the Format is “Mac OS X Extended (Journaled)” (in other words, this will be HFS+, the  Mac’s native filesystem) and the Image Format is “sparse bundle disk image“.

    Time Machine Disk Image Settings
  4. You can set Encryption if you want but not necessary. On the other hand,encrypting the disk image is a good idea since you’re going to put it on a network that can potentially be accessed by others.
  5. Save the disk image to the shared folder. Alternatively you can save the image locally and then move it to the destination folder on a server.

Tell Time Machine to use the Disk Image

  1. Open Finder
  2. Navigate to the shared folder which you put the new disk image.
  3. Double-click on the disk image to mount it. You should see the new volume in the Finder’s sidebar
  4. Open Terminal and enter the following command :
    sudo tmutil setdestination /Volumes/{mounted-disk-image}
    Be sure to replace {mounted-disk-image} with the appropriate name for your new disk image. You will be prompted for your password, this is normal.

Do a Test Backup

  1. Click the Time Machine icon in the Menu Extras area (that’s the upper-right side of the screen) and select “Back Up Now”.
  2. Wait for 10 minutes or so for Time Machine to do its thing
  3. Open Finder, navigate to the mounted disk image, and ensure that Time Machine have created the “Backups.backupdb” folder and there is a folder inside it with the same name as your computer.
So that’s just about it. You can also use this method to save backups to non-Mac drives, like NTFS drives, if you have the appropriate drivers installed to write to those filesystems (hint: MacFUSE+NTFS-3g or Tuxera’s NTFS driver). For more information on the tmutil command, type man tmutil at the Terminal.

Download files from the web via the OS X command line

Terminal IconI am frequently developing web pages and often times I find it frustrating when I can not restart my browser because I’m in the middle of a download. So when I need to download a large file and I don’t want to have to worry about whether or not Safari or Firefox continues to run with out interruption, I turn to the trusty Terminal! Next time you have a file you want to download, option-click it and copy the URL into your clipboard. Now open a Terminal window and type:
cd ~/Desktop
Now that we have changed our directory to the “Desktop” we can start our download. For the download we are going to use a built in utility called “curl”.
curl -O
Read on for a screenshot of curl in action.

Install wget in Mac OS X Without Homebrew or MacPorts

Install wget in Mac OS X
The command line tool wget lets you retrieve a group of files from FTP and HTTP protocols, it’s a very useful utility for web developers and powerusers to have around because it lets you do things like perform quick and dirty site backups and even mirror websites locally.
This approach is going to build and install wget in OS X from source, this means you’ll need Xcode and the Unix dev tools (free @ Mac App Store) installed, but it has the benefit of eliminating the need of a package manager like Homebrew or MacPorts.
Assuming you have Xcode and the command line tools installed, launch Terminal and enter the following commands:
First, use curl to download the latest wget source:
curl -O
Next we use tar to uncompress the files you just downloaded:
tar -xzf wget-1.13.4.tar.gz
Use cd to change to the directory:
cd wget-1.13.4
Configure with the appropriate –with-ssl flag to prevent a “GNUTLS not available” error:
./configure --with-ssl=openssl
Build the source:
Install wget, it ends up in /usr/local/bin/:
sudo make install
Confirm everything worked by running wget:
wget --help
Clean up by removing wget source files when finished:
cd .. && rm -rf wget*
You’re all set, enjoy wget in Mac OS X.

Move data from an old Mac to a new Mac

How to use Migration Assistant with a new installation

When you first fire up your new Mac, you’ll be compelled to walk through the setup process. Early in that process you’ll be offered the opportunity to transfer data from your old Mac to the new one via a wired Ethernet connection. This is your first glimpse of OS X’s Migration Assistant.
Specifically, when installing Lion you’ll see the Transfer Information To This Mac window. Within this window you see four options—From Another Mac, From A Windows PC, From Time Machine Or Other Disk, and Don’t Transfer Now. As you’ll likely be moving data from your old Mac to your new one, select From Another Mac and click the Continue button at the bottom of the screen.

Make sure that both your Macs are connected, via Ethernet, to the same network. You can’t use a wireless network because your new Mac isn’t yet configured to use a wireless network. Launch Migration Assistant on your old Mac (found in /Applications/Utilities) and in the window that appears select To Another Mac and click the Continue button on that Mac. Enter your administrator’s password when prompted. You’ll be told that you must quit other applications. Do so by clicking Continue.
On your new Mac, your old Mac will appear in the Select The Source window. Click on it and click the Continue button. A passcode will appear on the new Mac and also, eventually, on your old Mac. Click Continue on the old Mac and a Transfer Your Information window will appear on the new Mac. (The old Mac will display a message that reads “Your other Mac is ready.”) On your new Mac you now have the option to select the kind of data you want to transfer. Your choices include Users, Applications, Settings, and Other Files and Folders onnameofoldMac.

Migration Assistant allows you to broadly choose the kind of data to transfer.

Click the triangle next to the Users entry and you can select specific user accounts you’d like to transfer. Click the triangle next to a user name and you have the further option to choose specific locations to transfer data from—Desktop, Documents, Downloads, Movies, Music, Pictures, Public, and All Other Files and Folders. Uncheck any that you don’t want to transfer and click the Continue button at the bottom of the window. A Transferring Information window appears that provides you with an estimate of how long the transfer will take.
When the transfer is done, you’ll be walked through the rest of the setup process. If you transferred a user account, you’ll see that account name in Lion’s login screen.

Other ways to use Migration Assistant

You can choose to migrate data from another computer, Time Machine backup, or another disk.

But suppose you unpacked, fired up, and configured your new Mac without having access to your old Mac. Or you simply didn’t have the time to wait for all your old data to transfer when you first booted the new Mac. Or, months later, you’ve realized there is a fair hunk of old data that you now want on your Mac. Have you lost your only chance to use Migration Assistant? Absolutely not. You can run it any time you like, provided that your Macs are on the same network. (You can transfer data over a wireless network once both Macs have access to such a network.)
Just navigate to /Applications/Utilities and launch Migration Assistant. In the Migration Assistant window that appears, choose From Another Mac, PC, Time Machine Backup, or Other Disk option and click Continue. Enter your administrator’s password and click OK. In the next window (seen here) choose from the two options—From Another Mac or PC or From a Time Machine Backup or Other Disk.
Regardless of which you choose, you’ll eventually see the same list of data sources you would have seen had you run Migration Assistant after you first installed Lion—Users, Applications, Settings, and Other Files and Folder onnameofmac/drive. Note, however, that if you attempt to move data from a user account on the old Mac with the same name as an existing user account on the new Mac—your user name is Chris on each, for example—you’ll be told that you must create a new user name to transfer the data to.

How to restore data from Time Machine in Mountain Lion

Restore a single file or folder

If you’re looking for a certain file or folder, start by connecting the external drive that you use for Time Machine backups or by making sure that you can connect to your Time Capsule. Click the Time Machine item in the menu bar at the top of your screen (it looks like a clock with an arrow running counterclockwise around it), and choose Enter Time Machine. Here, all of your saved backups will appear in chronological order. Use the visual timeline on the right side to scroll through your backups and look for specific items or folders. Older dates are indicated in pink on the timeline; the most up-to-date data on your Mac is indicated in white. (You’ll see the word ‘Now’ in bold, white letters on the timeline.)
Not sure which backup might hold the last copy of your missing file? Try running a Spotlight search in Time Machine based on keywords. You’ll see a search field in the upper right corner of each Finder window in the Time Machine view. Type in the file name or keywords from the file, and Spotlight will search through your backups to find the latest copy.
Not sure where to find the file you need? You can perform a Spotlight search in Time Machine, using the search field (circled).
Once you think that you’ve found what you’re looking for, use OS X’s Quick Look to make sure: Select the file and then press the spacebar to view the file without having to launch its parent application.
Preview a file before you restore it by using OS X’s Quick Look feature.
Select the file or folder, and press the Restore button. The file will automatically be copied to your desktop or to the file’s original folder. This may take some time, depending on the size of the transfer.

Restore an entire system

Sometimes you may want to restore your entire system from a backup—say, in the event of a crash or when your computer is misbehaving and you’d like to dial the clock back to a kinder, gentler time. If that’s the case, first connect your Time Machine drive. Then start up your Mac from the Mountain Lion recovery partition by pressing (and holding down) Command-R at startup. This launches Recovery Mode, a portion of your drive that Mountain Lion treats as a separate volume. It includes a few essential utilities for restoring files in case of a problem. For this approach to work, you must have a complete Time Machine backup that includes all system files.
The Mac OS X Utilities window appears. Select Restore From Time Machine Backup. This command will erase the destination drive—your Mac—so use it only if you’re restoring an entire volume to its original source or to a replacement drive. (Read the next section for setting up a new Mac or transferring data between Macs.)
Click Continue until you reach the Select a Backup Source window. here, select your Time Machine drive and click Continue. In the Select a Destination window, choose your Mac’s hard drive. (Using Recovery Mode erases your Mac’s hard drive before restoring from Time Machine; but once the process is finished, you’ll be able to log in and use your Mac normally).

Transfer data between Macs

Let’s say that you bought a new Mac and want to transfer all of the data from your old system to it. Or imagine that you simply want to transfer data from one Mac to another. Time Machine can help here, too, but with the assistance of another built-in Mountain Lion utility called Migration Assistant.
Use OS X’s Migration Assistant to transfer data from a Time Machine backup to a another computer.
Once your backup drive is connected, launch Migration Assistant (in your /Applications/Utilities folder). A Migration Assistant window will appear and ask how you want to transfer your information. Choose the From another Mac, PC, Time Machine backup, or other disk option and then click Continue. You may be prompted to enter your administrator’s password. Do so, if necessary, and clickContinue.
Next, you’ll be asked to quit other applications. Do so, and click Continue. In the next window, select the From a Time Machine backup or other disk option and click Continue.
Select your backup drive and enter a password for it, if necessary. Then choose which items you’d like to migrate (chances are, your choice will be to move everything). Click Continue, and your files will begin to transfer.

Vi Text Editor Commands

As a brief introduction to vi, go through the following: First, type
vi x
at the Unix prompt. Assuming you did not already have a file named x, this command will create one. (If you have tried this example before, x will already exist, and vi will work on it. If you wish to start the example from scratch, simply remove x first.)
The file will of course initially be empty. To put something in it, type the letter i (it stands for “insert-text mode”), and type the following (including hitting the Enter key at the end of each of the three lines):
The quick
fox will return.
Then hit the Escape key, to end insert-text-mode.

Going Further: Other Frequently-Used Commands

You now know how to use vi to insert text, move the cursor to text, and delete text. Technically, the bare-bones set of commands introduced above is sufficient for any use of vi. However, if you limit yourself to these few commands, you will be doing a large amount of unnecessary, tiresome typing.
So, you should also learn at least some of these other frequently-used vi commands:
     h              move cursor one character to left
j move cursor one line down
k move cursor one line up
l move cursor one character to right
w move cursor one word to right
b move cursor one word to left
0 move cursor to beginning of line
$ move cursor to end of line
nG move cursor to line n
control-f scroll forward one screen
control-b scroll backward one screen

i insert to left of current cursor position (end with ESC)
a append to right of current cursor position (end with ESC)
dw delete current word (end with ESC)
cw change current word (end with ESC)
r change current character
~ change case (upper-, lower-) of current character

dd delete current line
D delete portion of current line to right of the cursor
x delete current character
ma mark currrent position
d`a delete everything from the marked position to here
`a go back to the marked position
p dump out at current place your last deletion (``paste'')

u undo the last command
. repeat the last command

J combine (``join'') next line with this one

:w write file to disk, stay in vi
:q! quit VI, do not write file to disk,
ZZ write file to disk, quit vi

:r filename read in a copy of the specified file to the current

/string search forward for string (end with Enter)
?string search backward for string (end with Enter)
n repeat the last search (``next search'')

:s/s1/s2 replace (``substitute'') (the first) s1 in this line by s2
:lr/s/s1/s2/g replace all instances of s1 in the line range lr by s2
(lr is of form `a,b', where a and b are either explicit
line numbers, or . (current line) or $ (last line)
:map k s map the key k to a string of vi commands s (see below)
:abb s1 s2 expand the string s1 in append/insert mode to a string
s2 (see below)
% go to the "mate," if one exists, of this parenthesis
or brace or bracket (very useful for programmers!)
All of the `:’ commands end with your hitting the Enter key. (By the way, these are called “ex” commands, after the name of the simpler editor from which vi is descended.)
The a command, which puts text to the right of the cursor, does put you in insert-text mode, just like the i command does.
By the way, if you need to insert a control character while in append/insert mode, hit control-v first. For example, to insert control-g into the file being edited, type control-v then control-g.
One of vi‘s advantages is easy cursor movement. Since the keys h,j,k,l are adjacent and easily accessible with the fingers of your right hand, you can quickly reach them to move the cursor, instead of fumbling around for the arrow keys as with many other editors (though they can be used in vi too). You will find that this use of h,j,k,l become second nature to you very quickly, very much increasing your speed, efficiency and enjoyment of text editing.
Many of the commands can be prefixed by a number. For example, 3dd means to delete (consecutive) three lines, starting with the current one. As an another example, 4cw will delete the next four words.
The p command can be used for “cut-and-paste” and copy operations. For example, to move three lines from place A to place B:
1. Move the cursor to A.
2. Type 3dd.
3. Move the cursor to B.
4. Type p.
The same steps can be used to copy text, except that p must be used twice, the first time being immediately after Step 2 (to put back the text just deleted).
Note that you can do operations like cut-and-paste, cursor movement, and so on, much more easily using a mouse. This requires a GUI version of vi, which we will discuss later in this document.