8 Replies
      Latest reply on Oct 31, 2019 10:09 AM by john daniel
      cristeab Level 1 Level 1 (0 points)

        Hi

         

        I am using from a C++ application the following bash command

         

        cp -r MyApp.app /Applications

         

        but no file is copied into /Application folder. This happens on macOS Catalina, but not on older OSs

         

        thanks

        Bogdan

        • Re: cannot copy application into /Applications folder
          john daniel Level 4 Level 4 (500 points)

          On Catalina, you will have to use the Finder to copy an app into Applications or use the data volume path.

            • Re: cannot copy application into /Applications folder
              eskimo Apple Staff Apple Staff (12,425 points)

              On Catalina, you will have to use the Finder to copy an app into Applications or use the data volume path.

              What makes you say that?  I’m able to copy things to /Applications/ from Terminal just fine:

              $ cp -R ManOpen.app /Applications 
              $ ls -lhd /Applications

              Also, the data volume path for /Applications/ is /Applications/.  It’s the system applications that were relocated, to /System/Applications/:

              $ ls -lh /System/Applications 
              total 0
              drwxr-xr-x   3 root  wheel    96B Sep 13 23:06 App Store.app
              …

              Share and Enjoy

              Quinn “The Eskimo!”
              Apple Developer Relations, Developer Technical Support, Core OS/Hardware
              let myEmail = "eskimo" + "1" + "@apple.com"

                • Re: cannot copy application into /Applications folder
                  john daniel Level 4 Level 4 (500 points)
                  eskimo wrote:

                   


                  What makes you say that?

                  I assumed that the OP was a beginner programmer learning C++ and trying install an app into the Applications folder. I thought an end-user approach using the Finder would be more helpful along with a comment about the data volume that might encourage them to learn more about it.

                   

                  I'm not entirely sure what jrumo's co-worker relationship to the OP is or why an Objective-C API would work in a C++ program. Perhaps I don't know all the details.

                   

                  I always thought that /Applications in Catalina was a firmlink to /System/Volumes/Data/Applications on the data volume. I have seen some really interesting re-arragements of system files in Catalina. And I have seen people doing some truly bizzare things with system files. I realize that firmlinks are perfectly useable, but I really would not recommend people engage in command-line operations on this particular path. Either they don't know what they are doing and need to learn the proper way to install apps or they need to fully understand what has changed in Catalina before they start applying hacks.

              • Re: cannot copy application into /Applications folder
                eskimo Apple Staff Apple Staff (12,425 points)

                First up, I recommend that you not copy applications by shelling out to cp.  Rather, you should use an API for this.  The best API for this is NSFileManager, but if you want to avoid Objective-C / Swift then copyfile is just fine.  See its man page for details.

                IMPORTANT If you continue using cp, use the -R flag.  The -r flag will break the app if it contains any symlinks (I relearnt that lesson the hard way recently)-:

                Once you switch to an API, things will either work or you’ll get some sort of error.  If it’s the latter, please post info about that error.

                Share and Enjoy

                Quinn “The Eskimo!”
                Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                let myEmail = "eskimo" + "1" + "@apple.com"