Unable to run shell script on system start on mac?How to run a shell script on a Unix console or Mac terminal?Mac OS - add app to autostart with launchctlUsing scripts in PackageMaker (Mac OS X)How to start PostgreSQL server on Mac OS X?(OSX) launchctl not allowing Python to stopMy mac osx launched plist won't runMac OSX LaunchDaemon on Startup, Shell Script with SSHMAC OS Sierra - Run app at startup?launchctl process showing non-zero exit codelaunchctl cannot find bundle
I have found a mistake on someone's code published online: what is the protocol?
Why won't some unicode characters print to my terminal?
What details should I consider before agreeing for part of my salary to be 'retained' by employer?
May I use a railway velocipede on used British railways?
Why jet engines sound louder on the ground than inside the aircraft?
Why teach C using scanf without talking about command line arguments?
Why isn't a binary file shown as 0s and 1s?
Who determines when road center lines are solid or dashed?
Should I have shared a document with a former employee?
How do you send money when you're not sure it's not a scam?
What was the average temperature of space near the Spitzer Satellite Telescope?
Desecrating Shabbos to ask a Gadol to daven for a patient?
Word for something indicating the importance of guarding it properly
What causes a rotating object to rotate forever without external force—inertia, or something else?
Strategy to pay off revolving debt while building reserve savings fund?
Should I use a resistor between the gate driver and MOSFET (gate pin)?
"Je suis petite, moi?", purpose of the "moi"?
The most secure way to handle someone forgetting to verify their account?
Is surviving this (blood loss) scenario possible?
Is this Android phone Android 9.0 or Android 6.0?
Why do space operations use "nominal" to mean "working correctly"?
What happens if a company buys back all of its shares?
ANOVA or Linear Mixed Model?
Arithmetics in LuaLaTeX
Unable to run shell script on system start on mac?
How to run a shell script on a Unix console or Mac terminal?Mac OS - add app to autostart with launchctlUsing scripts in PackageMaker (Mac OS X)How to start PostgreSQL server on Mac OS X?(OSX) launchctl not allowing Python to stopMy mac osx launched plist won't runMac OSX LaunchDaemon on Startup, Shell Script with SSHMAC OS Sierra - Run app at startup?launchctl process showing non-zero exit codelaunchctl cannot find bundle
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to run a shell script on mac startup. For that i have created a shell script and plist file. I have copied the plist to ~/Library/LaunchAgents/com.example.exampld.plist
. It has all required permissions.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.exampld</string>
<key>ProgramArguments</key>
<array><string>/Users/dhiraj/.mydir/startup.sh</string></array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I have loaded it using below commond
sudo launchctl load -w ~/Library/LaunchAgents/com.example.exampld.plist
And also tested using
sudo launchctl start ~/Library/LaunchAgents/com.example.exampld.plist
But the shell script code is not executed i can say this because my shell script start a go build and open browser as below but nothing happens.
echo #start up go build#
$HOME/.mydir/./go
open http://localhost/sample/index.html
macos launch launchctl
add a comment |
I want to run a shell script on mac startup. For that i have created a shell script and plist file. I have copied the plist to ~/Library/LaunchAgents/com.example.exampld.plist
. It has all required permissions.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.exampld</string>
<key>ProgramArguments</key>
<array><string>/Users/dhiraj/.mydir/startup.sh</string></array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I have loaded it using below commond
sudo launchctl load -w ~/Library/LaunchAgents/com.example.exampld.plist
And also tested using
sudo launchctl start ~/Library/LaunchAgents/com.example.exampld.plist
But the shell script code is not executed i can say this because my shell script start a go build and open browser as below but nothing happens.
echo #start up go build#
$HOME/.mydir/./go
open http://localhost/sample/index.html
macos launch launchctl
You haven't set aProgram
key so how will it know what to run? launchd.info
– Mark Setchell
Mar 26 at 10:10
add a comment |
I want to run a shell script on mac startup. For that i have created a shell script and plist file. I have copied the plist to ~/Library/LaunchAgents/com.example.exampld.plist
. It has all required permissions.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.exampld</string>
<key>ProgramArguments</key>
<array><string>/Users/dhiraj/.mydir/startup.sh</string></array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I have loaded it using below commond
sudo launchctl load -w ~/Library/LaunchAgents/com.example.exampld.plist
And also tested using
sudo launchctl start ~/Library/LaunchAgents/com.example.exampld.plist
But the shell script code is not executed i can say this because my shell script start a go build and open browser as below but nothing happens.
echo #start up go build#
$HOME/.mydir/./go
open http://localhost/sample/index.html
macos launch launchctl
I want to run a shell script on mac startup. For that i have created a shell script and plist file. I have copied the plist to ~/Library/LaunchAgents/com.example.exampld.plist
. It has all required permissions.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.exampld</string>
<key>ProgramArguments</key>
<array><string>/Users/dhiraj/.mydir/startup.sh</string></array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I have loaded it using below commond
sudo launchctl load -w ~/Library/LaunchAgents/com.example.exampld.plist
And also tested using
sudo launchctl start ~/Library/LaunchAgents/com.example.exampld.plist
But the shell script code is not executed i can say this because my shell script start a go build and open browser as below but nothing happens.
echo #start up go build#
$HOME/.mydir/./go
open http://localhost/sample/index.html
macos launch launchctl
macos launch launchctl
edited Mar 26 at 10:03
Flimzy
43.4k13 gold badges71 silver badges109 bronze badges
43.4k13 gold badges71 silver badges109 bronze badges
asked Mar 26 at 9:00
Dhiraj KumarDhiraj Kumar
1,73215 gold badges51 silver badges131 bronze badges
1,73215 gold badges51 silver badges131 bronze badges
You haven't set aProgram
key so how will it know what to run? launchd.info
– Mark Setchell
Mar 26 at 10:10
add a comment |
You haven't set aProgram
key so how will it know what to run? launchd.info
– Mark Setchell
Mar 26 at 10:10
You haven't set a
Program
key so how will it know what to run? launchd.info– Mark Setchell
Mar 26 at 10:10
You haven't set a
Program
key so how will it know what to run? launchd.info– Mark Setchell
Mar 26 at 10:10
add a comment |
1 Answer
1
active
oldest
votes
sudo launchctl load
loads launchd agents/daemons in the local domain (/Library/..
).
In the user domain you have to call launchctl
without sudo
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353199%2funable-to-run-shell-script-on-system-start-on-mac%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
sudo launchctl load
loads launchd agents/daemons in the local domain (/Library/..
).
In the user domain you have to call launchctl
without sudo
add a comment |
sudo launchctl load
loads launchd agents/daemons in the local domain (/Library/..
).
In the user domain you have to call launchctl
without sudo
add a comment |
sudo launchctl load
loads launchd agents/daemons in the local domain (/Library/..
).
In the user domain you have to call launchctl
without sudo
sudo launchctl load
loads launchd agents/daemons in the local domain (/Library/..
).
In the user domain you have to call launchctl
without sudo
answered Mar 26 at 10:11
vadianvadian
167k19 gold badges185 silver badges206 bronze badges
167k19 gold badges185 silver badges206 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353199%2funable-to-run-shell-script-on-system-start-on-mac%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You haven't set a
Program
key so how will it know what to run? launchd.info– Mark Setchell
Mar 26 at 10:10