Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure iTerm2 to open URLs in a specific browser?

Tags:

iterm2

I recently changed my default browser from Chrome to Safari, but I still do development in Chrome. I'd like URLs in iTerm2 to open up in Chrome, but now they open in Safari since its my system default.

Is it possible to change this?

like image 928
Sam Selikoff Avatar asked Oct 04 '17 15:10

Sam Selikoff


2 Answers

You can add a Context Menu option for the smart selection of a URL for Chrome via the Edit Actions of the Smart Selection Rules (within a given profile) with a parameter of:

open -a "Google Chrome" \0

enter image description here

Once you do this, this action will override the built-in default of using the system defined app (Safari in your case).

like image 55
SushiHangover Avatar answered Oct 16 '22 12:10

SushiHangover


If you are trying to open http://localhost:#PORT, it might be necessary to add in Smart Selection Rules a new rule with Regular Expression of https?://localhost(:[a-zA-Z0-9]+)? and Precision of Very High, before applying @SushiHangover's answer.

The default HTTP URL rule does not appear to recognize http://localhost well.

like image 39
Agboh Avatar answered Oct 16 '22 12:10

Agboh