Auto Execute a command or script on Mac Terminal Startup


In order to auto-execute a command or a script every time you open a Mac Terminal, follow the below steps,

  • Open Terminal App,
  • Go to Menu: Terminal -> Preferences... (Settings on macOS Ventura or later)
  • Go to Profile tab,
  • Now go to the shell tab,
  • Check "run command" under Startup and type the command or script that you want to execute.
Run command on Terminal Startup
Example:

Running a curl command to get the weather details every time you start a new terminal instance.

Get weather details Terminal
-

Facing issues? Have Questions? Post them here! I am happy to answer!




Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X














Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap