locked
How to put my application in Dock immediately after installation ? RRS feed

  • Question

  • User1636 posted

    Hello All,

    Is there a way where I can put my application in Mac Dock immediately after installation?
    Also
    How to auto-start application immediately after installing??
    Any solution or code snippet would be of great help!
    Thanks a ton in advance!!

    Tuesday, May 20, 2014 6:50 AM

Answers

  • User37725 posted

    you can create a .sh script file with script like open your.app and attach in the package as a post script. Tools like Packages provide options to include post installation script

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, May 20, 2014 12:33 PM

All replies

  • User37725 posted

    You can do that by adding a post installation script in the .pkg file.

    Tuesday, May 20, 2014 11:51 AM
  • User1636 posted

    @RemjithTk?,
    Thanks a ton for answering!!..Can you lead me to the direction how to achieve that?..Any link would be useful..

    Tuesday, May 20, 2014 12:19 PM
  • User1636 posted

    I tried using setting the Activation Policy

        NSApplication.SharedApplication.ActivationPolicy= NSApplicationActivationPolicy.Regular;
    


    but that didnot work.

    Tuesday, May 20, 2014 12:22 PM
  • User37725 posted

    you can create a .sh script file with script like open your.app and attach in the package as a post script. Tools like Packages provide options to include post installation script

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, May 20, 2014 12:33 PM
  • User1636 posted

    Thanks a ton for the answer..:)

    Tuesday, May 20, 2014 12:41 PM
  • User20908 posted

    @Prerana, take a look at this thread: https://forums.xamarin.com/discussion/comment/35017/

    Thursday, May 29, 2014 3:44 PM
  • User1636 posted

    Hey @NikolayIvanets? , thanks for the answer, yes I had checked your link too.
    Using Packages like @RemjithTk? suggested I was successfully able to create a package and add a post installation script to it. BUT the issue now I am facing is, the script which I wrote to add my application to Mac dock and autostart application after installation works perfect when I run it separately i.e from command line( It adds my application to Mac dock and starts it) but when I incorporate it in my package it does start the application after installation but does not add it to Mac dock..
    Following is my script:-

        #!/bin/bash
       defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key>    <dict><key>_CFURLString</key><string>/Applications/XYZ.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>";
    
    
      open /Applications/XYZ.app
    


    Can there be any permission issues?? But the shell script it working perfectly outside the package!
    Thanks a ton in advance.

    Friday, May 30, 2014 5:18 AM
  • User366628 posted

    @Prerana said: Hey @NikolayIvanets? , thanks for the answer, yes I had checked your link too.
    Using Packages like @RemjithTk? suggested I was successfully able to create a package and add a post installation script to it. BUT the issue now I am facing is, the script which I wrote to add my application to Mac dock and autostart application after installation works perfect when I run it separately i.e from command line( It adds my application to Mac dock and starts it) but when I incorporate it in my package it does start the application after installation but does not add it to Mac dock..
    Following is my script:-

        #!/bin/bash
       defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key>    <dict><key>_CFURLString</key><string>/Applications/XYZ.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>";
    
    
      open /Applications/XYZ.app
    


    Can there be any permission issues?? But the shell script it working perfectly outside the package!
    Thanks a ton in advance.

    Sorry for reviving an old thread, Were you or some one else able to add the script so that it will run after install?

    Thank you

    Wednesday, April 25, 2018 10:36 AM