1

I can open another terminal from a terminal with this command:

open -a terminal

Also, I can start a terminal at a specified directory

open -a terminal ~/Desktop 

I intend to make the computer do it automatically after I power on the machine. How do I accomplish this?

1
  • I'm not sure if it's the most elegant way, but you could make an Automator Application with this command and set the app to open on startup by adding it to the login items in System Preferences.
    – Joonas
    Nov 20, 2017 at 6:13

3 Answers 3

2

I would do this in two steps:

  1. Open terminal on log-in

    To do this, go to Apple menu > System Preferences > Users & Groups > Login Items and add terminal there.

  2. Run a specific command when terminal is launched

    Open Terminal, go to Settings > Profile > Shell and in the first box write the command that you want terminal to run. In your case something like cd ~/Desktop.

1

Mac Ventura location of Login Items has changed.

  1. To open terminal on login Go to Apple Menu > System Settings > General > Login Items > Open at Login > + (located lower left) > Applications (should be under Favorites on left) > Utilities > Terminal

  2. Run specific command on startup When terminal has the focus, Open Terminal Settings with ⌘, then Select > Profiles > Shell. Under Startup check the Run command box and enter desired command in the text box, ie. cd ~/Documents

-1

Enable auto-login, create a .sh script that does what you want and then add it to the startup items of the user that gets automatically logged in. If there's no concern about security that's how I might do it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .