Category Archives: Mac

Passwordless SSH Login between OS X and Remote Server

terminal-iconIf you commonly ssh from your OS X computer to a remote server such as a web server it makes sense to set up passwordless ssh login so you can have a secure connection without having to always enter your password. Setting up passwordless login also allows you to run automated scripts to help with managing things like offsite backups. Scripts can’t be automated if they require someone to be present at your machine typing in passwords every time they run.

It’s worth noting that you may first want to check if you already have existing ssh keys on your computer. This can be done by entering cd ~/.ssh [enter] at your terminal. If you get a response back stating “No such file or directory” then you need to proceed with the following steps.

To set up passwordless login between a remote unix/linux server and your OS X machine fire up terminal and…

1. generate an RSA private key

ssh-keygen -t rsa -C “your_email@example.com”

2. copy the key to your clipboard

pbcopy < ~/.ssh/id_rsa.pub

3. ssh into the webserver

ssh username@yoursite.com (login with your password for the last time)

4. make a .ssh directory, if it doesn’t already exist

mkdir .ssh

5. create an authorized_keys file and paste in the key from mac that you just copied to your clipboard

vi .ssh/authorized_keys (paste in key from clipboard, save)

6. set permissions for necessary files and directories on webserver

chmod go-w ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

That’s all there is to it. These steps could all be combined into a single line but the above is much easier to follow.

Mac OSX Lion Cursor Disappeared? Get It Back

Mac OSX Cursor Gone
Did Lion devour my cursor?

From what I’ve found when searching online, I’m not the only one who has their cursor periodically disappear in OSX Lion. Once in a while I’ll return to my Mac Mini (my iMac and Macbook Pro never have this problem) and my cursor is nowhere to be found. The mouse or trackpad still works; if you go way down on the screen over the dock the hover affect will work but the cursor is still not visible.

Zoom the Screen

One way I found to bring the cursor back is to zoom the screen. If you don’t already know this, you can zoom in the screen at any time by holding down the ctrl key and scrolling up (or down depending on your system preferences). You can then zoom back to normal again by doing the opposite and, voila! Your cursor is back.

I can’t guarantee that this will work for you but it definitely works for me and I’ve heard from many others who say the same. Hopefully this tip will help you end the frustration of the missing Lion cursor.

If you have another solution to this issue, please do let me know in the comments. I’m sure others would love to hear about it too. The above solution works but it still annoying.

Fix For PayPal CSV Transaction History Download

PayPal Issues
PayPal Issues Solved

Have you been frustrated with trying to download your PayPal transaction history only to have the browser spin it’s wheels forever. Even if your report is small, the download still usually fails. I’ve fought with this many times and have finally found the fix. Apparently this is due to a PayPal timeout issue. You can fix this problem by using a terminal command to “aggressively try and keep the connection to PayPal alive” so the download can finish.

So, to fix this on a Mac,:

  • go to your History page on PayPal
  • select your date range
  • open Terminal or iTerm
  • enter the following
    • sudo sysctl -w net.inet.tcp.keepidle=10000 net.inet.tcp.keepintvl=5000 net.inet.tcp.always_keepalive=­1
  • enter your admin password
  • successfully download your transactions!

If your transaction list is huge you may still have to narrow your history search.

Thanks to Mark for posting this solution. I found it here: http://www.youtube.com/watch?v=U8jPvIGX6aw

Fix ‘Unkown host’ Error on Mac

Have you ever had one of your websites become inaccessible on only one of your computers? The site loads up fine on every other machine you try it on but on this one machine, nada. If you try to ping the domain you’ll likely be presented with an ‘unknown host’ error.

If your computer is a Mac you will likely first think to try dscacheutil -flushcache . However, this will not work for you unless you are using an older version of OS X. Now what you’ll have to do is the following:

sudo killall -HUP mDNSResponder

In most cases this is what will work for you. I won’t bore you with a lengthy explanation of why. Just try it.

What Happened to File Paths in Lion’s Spotlight Results?

Spotlight in Lion

Being a nerd I love keyboard shortcuts. Because of this, when using a Mac I use Spotlight extensively. I use Spotlight as a calculator, for word definitions, and most frequently, to launch applications and find files.

One of the many changes in OS X Lion is a change in Spotlight is that it no longer displays the path to a file on your machine when you mouseover a search result. Previously I used this all the time when trying to locate files. How could Apple get ride of this extremely useful feature?

Well, they didn’t. It’s still available but is a bit more hidden. I’m not sure where this is documented or how we were supposed to figure it out but thanks to Richard Cardona and the CapMac Forums I learned how to get file paths again. Now I’ll share it with you.

  1. As before, enter your search query in Spotlight.
  2. Also as before, either use your arrow keys to move down to the appropriate search result or mouseover the search result
  3. When the new preview window pops up to the left of the Spotlight results, hold down the command key

At the bottom of the preview window the name of the file will initially be displayed. Keep holding down the command key and in a second or two the path of the file will be revealed! Now you know where that file is located on your system.

Lion Spotlight Search Results with File Path
While holding down the Command button

Apples to Apple: Fun and Interesting Infographic

Here’s a fun infographic comparing Apple, the company to apples, the fruit.

A few of my favorite points:

  • China produces 44% of the world’s apples and 100% of the world’s Apples
  • the average apple weighs about the same as an Apple iPhone 4s (5oz. versus 4.9oz.)
  • an iphone 4s is 33.6% glass

Thanks to MBA Online for putting this one together.

Apples to Apple: more similar than you might think
Apples to Apple: more similar than you might think

Installing node.js on Mac OSX

Node js
Node.js

I recently installed node.js on a Mac running OSX 10.7.2 and these were the steps I followed at the command line.  Git and Xcode were already installed on the machine so this assumes they are already present.

  1. git clone git://github.com/ry/node.git
  2. cd node
  3. ./configure
  4. make
  5. sudo make install

You can test that node is installed by running a simple program such as:

var http = require('http');
http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text/plain'});
  response.end('Node.js has arrived.\n');
}).listen(1337, "127.0.0.1");
console.log('Up and running at http://127.0.0.1:1337/');

You can run this code by saving it as something like testing-node.js and then entering the command:

node testin-node.js

That’s it. Node.js is now up and running on port 1337 !

PS: stop the server with ctrl + c

 

Command Line Tip: Position Cursor with the Mouse

command line tip - place your cursor with the mouse
Place your cursor with the mouse

When entering long commands in the terminal, making changes or fixing mistakes in the middle of the command can slow you down. Moving your cursor over one character at a time to get the to point where the change is needed takes too much time! Fortunately on a Mac you can actually use your mouse to position the cursor wherever you want in the current line.

The trick is to hold down the ‘Option’ key while clicking. Move your mouse pointer where you want the cursor and ‘Option-Click’. When doing this the cursor will actually move to that point in the line. I didn’t believe it until I tried it. It really works! Another command line time saver.

Copy and Paste Without Formatting in Chrome

Google Chrome Logo
Copy – Paste Relief!

For people who work extensively on the web, copying and pasting can be a huge pain; not because the act of copying and pasting itself is a difficult tasks but because when you copy some text from a web page, the formatting of that text will tag along. Normally you just want the content in plain text. People often end up copying the content into a word processor like Textmate or Notepad and then re-copying and re-pasting. What a hassle!

Well, there is a handy built-in shortcut in Google Chrome (my choice for best browser) that automatically removes formatting when you paste. Yay! If you are on a Mac, the shortcut is ‘Command-Option-Shift-v’ and if you are on Windows it is ‘Control-Shift-v’.

The 4 key shortcut on Mac is a bit of a ‘handful’ but it is well worth it.

Top Right Bubble in Mac OS X: The Lozenge

Have you ever noticed that wide grey bubble in the top right of some of your Mac application windows? When I first moved to Mac it took a while before I even noticed it.  Its actually quite handy.

The button, sometimes called the ‘lozenge’ is used in applications that have a ‘Hide Toolbar’ option in their ‘View’ menu.

In Finder the button will hide both the toolbar and the sidebar. If you command-click the button it will modify how the toolbar is displayed, cycling through variations of words and buttons, buttons only, words only and various different sizes of buttons etc.

The Mac Lozenge
The Lozenge

Another handy use of the lozenge is installing an app. When doing so you are often presented with the window that has the app icon. Sometimes there will be an Applications icon that you can simply drag the app icon into in order to move the app to the Applications folder. When this isn’t the case people usually think they need to open another Finder window in order to drag the app to the Applications folder. However, the lozenge can save you this trouble. Simply click on it and a sidebar will appear and you can drag the app to the Applications folder listed there. Nice!

Some other applications that have the ‘lozenge’ include:

Mail, Preview and Adium.