What does launchctl unload actually do?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite
1












When running launchctl unload some.plist, what is this command translated to specifically, in terms of UNIX commands, etc.



There is nothing in .plist files that specifies any "command line to run when the user specifies unload", so does macOS simply send a kill signal to the process? Or what does it do?







share|improve this question

























    up vote
    2
    down vote

    favorite
    1












    When running launchctl unload some.plist, what is this command translated to specifically, in terms of UNIX commands, etc.



    There is nothing in .plist files that specifies any "command line to run when the user specifies unload", so does macOS simply send a kill signal to the process? Or what does it do?







    share|improve this question





















      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      When running launchctl unload some.plist, what is this command translated to specifically, in terms of UNIX commands, etc.



      There is nothing in .plist files that specifies any "command line to run when the user specifies unload", so does macOS simply send a kill signal to the process? Or what does it do?







      share|improve this question











      When running launchctl unload some.plist, what is this command translated to specifically, in terms of UNIX commands, etc.



      There is nothing in .plist files that specifies any "command line to run when the user specifies unload", so does macOS simply send a kill signal to the process? Or what does it do?









      share|improve this question










      share|improve this question




      share|improve this question









      asked 12 hours ago









      forthrin

      1,00241429




      1,00241429




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          6
          down vote













          SIGTERM



          launchd's unload command sends a SIGTERM signal to the associated job's child processes.



          Detached Processes



          If a process launched by a launchd job has detached from it's parent process, then unload will not affect that process. This is often the case for daemonised processes.



          Original Source Code



          You can download and inspect the original launchd source code. launchd has since been rewritten and is proprietary to Apple but the original documents the intended behaviour on unload.






          share|improve this answer























          • Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
            – forthrin
            11 hours ago






          • 1




            A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
            – Graham Miln
            11 hours ago

















          up vote
          1
          down vote













          To best answer this question we can look at two things: UNIX commands and what is in a .plist.



          Starting out with a .plist, the following code is usually there



          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
          <plist version="1.0">
          <dict>
          <key>CFBundleExecutable</key>
          <string>someApplication</string>
          </dict>
          </plist>


          The CFBundleExecutable identifies the name of the bundle’s main executable file. For an app, this is the app executable. For a loadable bundle, it is the binary that will be loaded dynamically by the bundle.



          So typing launchctl unload some.plist will tell MacOS the key to locate the bundle’s executable file and 'unload' it or essentially kill it from the system.
          This is telling it at an application level.



          When using a UNIX command such as kill <PID> it is in reference to a specific process.



          Looking at what is a Process vs Application here is good reading





          You can read further into what is in .plists and how they work over at Apple






          share|improve this answer





















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "118"
            ;
            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f332931%2fwhat-does-launchctl-unload-actually-do%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote













            SIGTERM



            launchd's unload command sends a SIGTERM signal to the associated job's child processes.



            Detached Processes



            If a process launched by a launchd job has detached from it's parent process, then unload will not affect that process. This is often the case for daemonised processes.



            Original Source Code



            You can download and inspect the original launchd source code. launchd has since been rewritten and is proprietary to Apple but the original documents the intended behaviour on unload.






            share|improve this answer























            • Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
              – forthrin
              11 hours ago






            • 1




              A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
              – Graham Miln
              11 hours ago














            up vote
            6
            down vote













            SIGTERM



            launchd's unload command sends a SIGTERM signal to the associated job's child processes.



            Detached Processes



            If a process launched by a launchd job has detached from it's parent process, then unload will not affect that process. This is often the case for daemonised processes.



            Original Source Code



            You can download and inspect the original launchd source code. launchd has since been rewritten and is proprietary to Apple but the original documents the intended behaviour on unload.






            share|improve this answer























            • Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
              – forthrin
              11 hours ago






            • 1




              A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
              – Graham Miln
              11 hours ago












            up vote
            6
            down vote










            up vote
            6
            down vote









            SIGTERM



            launchd's unload command sends a SIGTERM signal to the associated job's child processes.



            Detached Processes



            If a process launched by a launchd job has detached from it's parent process, then unload will not affect that process. This is often the case for daemonised processes.



            Original Source Code



            You can download and inspect the original launchd source code. launchd has since been rewritten and is proprietary to Apple but the original documents the intended behaviour on unload.






            share|improve this answer















            SIGTERM



            launchd's unload command sends a SIGTERM signal to the associated job's child processes.



            Detached Processes



            If a process launched by a launchd job has detached from it's parent process, then unload will not affect that process. This is often the case for daemonised processes.



            Original Source Code



            You can download and inspect the original launchd source code. launchd has since been rewritten and is proprietary to Apple but the original documents the intended behaviour on unload.







            share|improve this answer















            share|improve this answer



            share|improve this answer








            edited 11 hours ago


























            answered 12 hours ago









            Graham Miln

            24.6k55784




            24.6k55784











            • Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
              – forthrin
              11 hours ago






            • 1




              A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
              – Graham Miln
              11 hours ago
















            • Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
              – forthrin
              11 hours ago






            • 1




              A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
              – Graham Miln
              11 hours ago















            Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
            – forthrin
            11 hours ago




            Very good answer! So it's SIGTERM, then. My next question is whether there's a standard UNIX (or macOS) way to know when a stopping a daemon has been completely finalised, because the prompt doesn't wait for that, does it? I'll be happy to post a new question about that if it doesn't fit within the scope of this question.
            – forthrin
            11 hours ago




            1




            1




            A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
            – Graham Miln
            11 hours ago




            A modern UNIX process can use kqueue to be notified when a process terminates, see stackoverflow.com/questions/22960188 and Chrome's kill_mac.cc source. For more detailed answers and to ask for shell specific answers, please ask a new question.
            – Graham Miln
            11 hours ago












            up vote
            1
            down vote













            To best answer this question we can look at two things: UNIX commands and what is in a .plist.



            Starting out with a .plist, the following code is usually there



            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
            <plist version="1.0">
            <dict>
            <key>CFBundleExecutable</key>
            <string>someApplication</string>
            </dict>
            </plist>


            The CFBundleExecutable identifies the name of the bundle’s main executable file. For an app, this is the app executable. For a loadable bundle, it is the binary that will be loaded dynamically by the bundle.



            So typing launchctl unload some.plist will tell MacOS the key to locate the bundle’s executable file and 'unload' it or essentially kill it from the system.
            This is telling it at an application level.



            When using a UNIX command such as kill <PID> it is in reference to a specific process.



            Looking at what is a Process vs Application here is good reading





            You can read further into what is in .plists and how they work over at Apple






            share|improve this answer

























              up vote
              1
              down vote













              To best answer this question we can look at two things: UNIX commands and what is in a .plist.



              Starting out with a .plist, the following code is usually there



              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
              <plist version="1.0">
              <dict>
              <key>CFBundleExecutable</key>
              <string>someApplication</string>
              </dict>
              </plist>


              The CFBundleExecutable identifies the name of the bundle’s main executable file. For an app, this is the app executable. For a loadable bundle, it is the binary that will be loaded dynamically by the bundle.



              So typing launchctl unload some.plist will tell MacOS the key to locate the bundle’s executable file and 'unload' it or essentially kill it from the system.
              This is telling it at an application level.



              When using a UNIX command such as kill <PID> it is in reference to a specific process.



              Looking at what is a Process vs Application here is good reading





              You can read further into what is in .plists and how they work over at Apple






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                To best answer this question we can look at two things: UNIX commands and what is in a .plist.



                Starting out with a .plist, the following code is usually there



                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                <plist version="1.0">
                <dict>
                <key>CFBundleExecutable</key>
                <string>someApplication</string>
                </dict>
                </plist>


                The CFBundleExecutable identifies the name of the bundle’s main executable file. For an app, this is the app executable. For a loadable bundle, it is the binary that will be loaded dynamically by the bundle.



                So typing launchctl unload some.plist will tell MacOS the key to locate the bundle’s executable file and 'unload' it or essentially kill it from the system.
                This is telling it at an application level.



                When using a UNIX command such as kill <PID> it is in reference to a specific process.



                Looking at what is a Process vs Application here is good reading





                You can read further into what is in .plists and how they work over at Apple






                share|improve this answer













                To best answer this question we can look at two things: UNIX commands and what is in a .plist.



                Starting out with a .plist, the following code is usually there



                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                <plist version="1.0">
                <dict>
                <key>CFBundleExecutable</key>
                <string>someApplication</string>
                </dict>
                </plist>


                The CFBundleExecutable identifies the name of the bundle’s main executable file. For an app, this is the app executable. For a loadable bundle, it is the binary that will be loaded dynamically by the bundle.



                So typing launchctl unload some.plist will tell MacOS the key to locate the bundle’s executable file and 'unload' it or essentially kill it from the system.
                This is telling it at an application level.



                When using a UNIX command such as kill <PID> it is in reference to a specific process.



                Looking at what is a Process vs Application here is good reading





                You can read further into what is in .plists and how they work over at Apple







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered 12 hours ago









                akostar

                1196




                1196






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f332931%2fwhat-does-launchctl-unload-actually-do%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    Color the edges and diagonals of a regular polygon

                    Relationship between determinant of matrix and determinant of adjoint?

                    What is the equation of a 3D cone with generalised tilt?