# Open Julia in iTerm2 by default, instead of Terminal

**URL:** https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643
**Category:** New to Julia
**Tags:** question
**Created:** [January 27, 2018, 6:35pm UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643 "2018-01-27T18:35:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sidrocks123](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@sidrocks123](https://discourse.julialang.org/u/sidrocks123)
#### Post date: [January 27, 2018, 6:35pm UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/1 "2018-01-27T18:35:51Z")

</div>

I installed Julia on macOS High Sierra (10.13.3) with `brew cask install julia`, and it opens in Apple Terminal by default.  
I am completely new to AppleScript, so I don’t know how to change the default behavior of Julia so that it opens in iTerm2 by default. (App ID - com.googlecode.iterm2).

This is the script for starting Julia:

```julia
set RootPath to POSIX path of (path to me)
tell application id "com.apple.terminal"
	do script ("exec '" & RootPath & "Contents/Resources/julia/bin/julia'")
	activate
end tell

```

Any idea how this can be done?

---

<div class="post-metadata">

### Author: ![favba](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/favba/32/2735_2.png) [@favba](https://discourse.julialang.org/u/favba)
#### Post date: [January 27, 2018, 7:05pm UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/2 "2018-01-27T19:05:52Z")

</div>

I guess, and this is a GUESS,:

```nohighlight
set RootPath to POSIX path of (path to me)
tell application id "com.googlecode.iterm2"
	do script ("exec '" & RootPath & "Contents/Resources/julia/bin/julia'")
	activate
end tell

```

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [January 28, 2018, 4:53am UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/3 "2018-01-28T04:53:00Z")

</div>

How are you opening it? Why not just type “julia” from within iterm2? You may need to set up an alias for this to work.

---

<div class="post-metadata">

### Author: ![sidrocks123](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@sidrocks123](https://discourse.julialang.org/u/sidrocks123)
#### Post date: [January 28, 2018, 8:56am UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/4 "2018-01-28T08:56:31Z")

</div>

It doesn’t work, I tried it yesterday too. It says, “expected end of line, but found script”. Don’t know what it means, though.

---

<div class="post-metadata">

### Author: ![sidrocks123](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@sidrocks123](https://discourse.julialang.org/u/sidrocks123)
#### Post date: [January 28, 2018, 8:56am UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/5 "2018-01-28T08:56:40Z")

</div>

Yes, I can open it with Julia within iTerm2, but I prefer opening Julia through Spotlight (i.e. through the executable by searching it, and then running it), but the script that is run by Julia invokes Terminal by default, and not iTerm2 (and I can’t change the script so that it invokes iTerm2, don’t know why. Throws up an error). Just a matter of convenience.

---

<div class="post-metadata">

### Author: ![bbrietzke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bbrietzke/32/6155_2.png) [@bbrietzke](https://discourse.julialang.org/u/bbrietzke)
#### Post date: [November 20, 2018, 1:50am UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/6 "2018-11-20T01:50:21Z")

</div>

Apologies for resurrecting an old thread but if you open _/Applications/Julia-1.0.app/Contents/Resources/Scripts_, you can change the file to something similar to:

```julia
set RootPath to POSIX path of (path to me)
tell application "iTerm"
	tell current window
		create tab with default profile command "/Applications/Julia-1.0.app/Contents/Resources/julia/bin/julia"
		activate
	end tell
end tell

```

---

<div class="post-metadata">

### Author: ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)
#### Post date: [June 6, 2019, 7:08pm UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/7 "2019-06-06T19:08:01Z")

</div>

Great!

---

<div class="post-metadata">

### Author: ![jayanthbagare](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayanthbagare/32/27766_2.png) [@jayanthbagare](https://discourse.julialang.org/u/jayanthbagare)
#### Post date: [August 3, 2021, 4:58am UTC](https://discourse.julialang.org/t/open-julia-in-iterm2-by-default-instead-of-terminal/8643/8 "2021-08-03T04:58:53Z")

</div>

Super thanks for the script, I learnt now something new. 😀
