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;








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









share|improve this question
























  • You haven't set a Program key so how will it know what to run? launchd.info

    – Mark Setchell
    Mar 26 at 10:10


















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









share|improve this question
























  • You haven't set a Program key so how will it know what to run? launchd.info

    – Mark Setchell
    Mar 26 at 10:10














0












0








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









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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

















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













1 Answer
1






active

oldest

votes


















0














sudo launchctl load loads launchd agents/daemons in the local domain (/Library/..).



In the user domain you have to call launchctl without sudo






share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    sudo launchctl load loads launchd agents/daemons in the local domain (/Library/..).



    In the user domain you have to call launchctl without sudo






    share|improve this answer



























      0














      sudo launchctl load loads launchd agents/daemons in the local domain (/Library/..).



      In the user domain you have to call launchctl without sudo






      share|improve this answer

























        0












        0








        0







        sudo launchctl load loads launchd agents/daemons in the local domain (/Library/..).



        In the user domain you have to call launchctl without sudo






        share|improve this answer













        sudo launchctl load loads launchd agents/daemons in the local domain (/Library/..).



        In the user domain you have to call launchctl without sudo







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 26 at 10:11









        vadianvadian

        167k19 gold badges185 silver badges206 bronze badges




        167k19 gold badges185 silver badges206 bronze badges


















            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.



















            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript