Open a bunch of URLs from the clipboard in a browser on the Mac

Just now I had a bunch of URLs in a spreadsheet I wanted to quickly open. This time, it wasn’t too quick, because I went down the rabbit hole of coming up with a solution (and making a blog post about it). Next time though….


  1. Copy your URLs into the clipboard (⌘C or Edit > Copy)
  2. Open a terminal
  3. Type:
    pbpaste|tr '\n' '\0'|xargs -0 -I{} open /Applications/ {} &

Quick rundown:

  • pbpaste is a command that simply outputs your current clipboard entry. You can pipe it anywhere you like. (Incidentally, a useful counterparts is pbcopy; you can pipe the output of any other command into it and it ends up in your clipboard, ready for pasting anywhere.)
  • tr converts newlines to nulls
  • xargs is the center of this whole thing. It feeds the individual lines to a command of our choice, in this case the open command, which we tell to use Safari (you could just as easily substitute your favourite browser, assuming it accepts a URL from the command line this way).


This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>