{"id":31133,"date":"2022-04-06T18:32:54","date_gmt":"2022-04-06T17:32:54","guid":{"rendered":"https:\/\/www.n-able.com\/?p=31133"},"modified":"2022-10-20T18:24:38","modified_gmt":"2022-10-20T17:24:38","slug":"create-a-pkg-users-can-double-click-to-install","status":"publish","type":"post","link":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install","title":{"rendered":"Double Click to Install: Create a PKG even your users can install from"},"content":{"rendered":"<p class=\"p4\"><span class=\"s1\">You\u2019ve got a script. Maybe you wrote it or maybe you found it online, but it handily solves a problem your users face or does a task you typically spend several minutes on with a single command many times a day. With any RMM platform, it would normally be a simple matter of deploying the script to those devices, setting the schedule for it to run, then sitting back and sipping your beverage of choice. Unless you\u2019re in the server room<\/span><span class=\"s2\">\u2014<\/span><span class=\"s1\">no food or drink in the server room.<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">But what if the problem you\u2019re solving is that Mac that can\u2019t connect to the server? Or that its configuration is somehow corrupted and it won\u2019t stay connected? Or, for that matter, the user is remote and you don\u2019t have a remote management platform yet and need to install one. <\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">You\u2019ve wandered into a classic catch-22: in order to install or fix remote management, you need working remote management.<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">You could email the script to the user with instructions for running it in the Terminal, but that way lies madness. Terminal is scary. Nobody reads the instructions. And even when they do, there\u2019s no way to anticipate every question you\u2019ll get: \u201cDo I include the quotation marks around my password? What is my password?\u201d<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">No. You need to deliver something that any average user can double-click on and be reasonably confident it will run without a hitch.<\/span><\/p>\n<h2 class=\"p4\"><span class=\"s1\">Installing your new app<\/span><\/h2>\n<p class=\"p4\"><span class=\"s1\">Aside from the occasional custom installer app, there are two primary ways in which a user installs applications on their Mac. The first is dragging the new app\u2019s icon into the Applications folder. The second is launching the macOS Installer.app by double-clicking on a PKG file. The package format includes the ability to run scripts before and\/or after the installation process. You can use this to your advantage even if you\u2019re not actually installing anything. While building a full drag-and-drop application requires learning Xcode and Swift, all you need to create your own PKG installer is a Mac and your script.<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">I write most of my automations in Bash, or to be more precise these days, zsh. I still call them \u201cBash scripts\u201d because I like to believe it makes me sound like I\u2019m swinging a battle axe (\u201cScript, bash!\u201d). But a script deployed via PKG can be in any language the target Mac understands. AppleScript, Python, Ruby, PowerShell\u2014if you are confident that a compatible interpreter is installed, use your weapon of choice. Just be sure to include the proper \u201cshebang\u201d line at the beginning (#!\/bin\/bash for example).<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">Once your script is tested and working, rename it to \u201cpostinstall\u201d and put it into a folder called \u201cscripts\u201d.<\/span><\/p>\n<h2 class=\"p4\"><span class=\"s1\">Avoiding Terminal terror<\/span><\/h2>\n<p class=\"p4\"><span class=\"s1\">The rest is done in Terminal. Do not be afraid. There are utilities that will do this part for you and add in some optional bells and whistles but, for our purposes, it requires just two commands.<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">Navigate to your scripts folder, the one with \u201cpostinstall\u201d in it. That will need to be executable so it will run as part of the installation. Like so:<\/span><\/p>\n<p class=\"p4\"><i>chmod a+x postinstall<\/i><\/p>\n<p class=\"p4\"><span class=\"s1\">Then, the magic incantation to create the package:<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\"><i>sudo pkgbuild &#8211;identifier your.unique.identifier &#8211;nopayload &#8211;scripts \/path\/to\/scripts \/path\/to\/package-name.pkg<\/i><\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">Replace \u201cyour.unique.identifier\u201d with a string that will identify you as the author in case someone examines the PKG. These are usually in the form of a \u201creverse domain name\u201d like \u201ccom.example.installer\u201d but really, it could be anything that\u2019s unique. Also, fill in the paths for the scripts folder and where you want the PKG file to appear.<\/span><\/p>\n<p class=\"p4\"><span class=\"s1\">If you\u2019ve done it right, you should end up with a file you can send to any user and have them double-click and install. The script will run, hidden behind the friendly fa\u00e7ade of the system installer, with no need for them to launch Terminal or type in commands. They will need to remember their password though.<\/span><\/p>\n<p class=\"p4\"><em><strong><span class=\"s1\">[Challenge for advanced students: Write your own script that automates this process!]<\/span><\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deploying new scripts to users isn\u2019t always a straightforward process. This blog looks at how to make the process really easy with a simple PKG file.<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-31133","post","type-post","status-publish","format-standard","hentry","topic-apple","topic-head-nerds"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Double Click to Install: Create a PKG even your users can install from - N-able<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Double Click to Install: Create a PKG even your users can install from - N-able\" \/>\n<meta property=\"og:description\" content=\"Deploying new scripts to users isn\u2019t always a straightforward process. This blog looks at how to make the process really easy with a simple PKG file.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\" \/>\n<meta property=\"og:site_name\" content=\"N-able\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/NableMSP\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-06T17:32:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-20T17:24:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.n-able.com\/wp-content\/uploads\/2022\/04\/220926_blogbanner_DoubleClickToInstall_ss.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"N-able\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.n-able.com\/wp-content\/uploads\/2022\/04\/220926_blogbanner_DoubleClickToInstall_ss.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@Nable\" \/>\n<meta name=\"twitter:site\" content=\"@Nable\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"N-able\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\"},\"author\":{\"name\":\"N-able\",\"@id\":\"https:\/\/www.n-able.com\/de#\/schema\/person\/f46a000e389b6d02bd4b3866e7828a7b\"},\"headline\":\"Double Click to Install: Create a PKG even your users can install from\",\"datePublished\":\"2022-04-06T18:32:54+01:00\",\"dateModified\":\"2022-10-20T17:24:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\"},\"wordCount\":704,\"publisher\":{\"@id\":\"https:\/\/www.n-able.com\/de#organization\"},\"articleSection\":[\"Head Nerds\",\"Mac Support\"],\"inLanguage\":\"de\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\",\"url\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\",\"name\":\"Double Click to Install: Create a PKG even your users can install from - N-able\",\"isPartOf\":{\"@id\":\"https:\/\/www.n-able.com\/de#website\"},\"datePublished\":\"2022-04-06T18:32:54+01:00\",\"dateModified\":\"2022-10-20T17:24:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Head Nerds\",\"item\":\"https:\/\/www.n-able.com\/de\/blog\/category\/head-nerds-de\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Double Click to Install: Create a PKG even your users can install from\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.n-able.com\/de#website\",\"url\":\"https:\/\/www.n-able.com\/de\",\"name\":\"N-able\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.n-able.com\/de#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.n-able.com\/de?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.n-able.com\/de#organization\",\"name\":\"N-able\",\"url\":\"https:\/\/www.n-able.com\/de\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.n-able.com\/de#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.n-able.com\/wp-content\/uploads\/2021\/02\/logo-n-able-vertical-dark.svg\",\"contentUrl\":\"https:\/\/www.n-able.com\/wp-content\/uploads\/2021\/02\/logo-n-able-vertical-dark.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"N-able\"},\"image\":{\"@id\":\"https:\/\/www.n-able.com\/de#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/NableMSP\",\"https:\/\/x.com\/Nable\",\"https:\/\/www.linkedin.com\/company\/n-able\",\"https:\/\/www.youtube.com\/channel\/UClnp77HHg4aME-S-3fWQhFw\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.n-able.com\/de#\/schema\/person\/f46a000e389b6d02bd4b3866e7828a7b\",\"name\":\"N-able\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/e9c468b7c98137ecdd5508befa660c205a7978133257080a37fb0b1362d53411?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e9c468b7c98137ecdd5508befa660c205a7978133257080a37fb0b1362d53411?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e9c468b7c98137ecdd5508befa660c205a7978133257080a37fb0b1362d53411?s=96&d=mm&r=g\",\"caption\":\"N-able\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Double Click to Install: Create a PKG even your users can install from - N-able","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install","og_locale":"de_DE","og_type":"article","og_title":"Double Click to Install: Create a PKG even your users can install from - N-able","og_description":"Deploying new scripts to users isn\u2019t always a straightforward process. This blog looks at how to make the process really easy with a simple PKG file.","og_url":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install","og_site_name":"N-able","article_publisher":"https:\/\/www.facebook.com\/NableMSP","article_published_time":"2022-04-06T17:32:54+00:00","article_modified_time":"2022-10-20T17:24:38+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.n-able.com\/wp-content\/uploads\/2022\/04\/220926_blogbanner_DoubleClickToInstall_ss.jpg","type":"image\/jpeg"}],"author":"N-able","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.n-able.com\/wp-content\/uploads\/2022\/04\/220926_blogbanner_DoubleClickToInstall_ss.jpg","twitter_creator":"@Nable","twitter_site":"@Nable","twitter_misc":{"Verfasst von":"N-able","Gesch\u00e4tzte Lesezeit":"3\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install#article","isPartOf":{"@id":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install"},"author":{"name":"N-able","@id":"https:\/\/www.n-able.com\/de#\/schema\/person\/f46a000e389b6d02bd4b3866e7828a7b"},"headline":"Double Click to Install: Create a PKG even your users can install from","datePublished":"2022-04-06T18:32:54+01:00","dateModified":"2022-10-20T17:24:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install"},"wordCount":704,"publisher":{"@id":"https:\/\/www.n-able.com\/de#organization"},"articleSection":["Head Nerds","Mac Support"],"inLanguage":"de"},{"@type":"WebPage","@id":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install","url":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install","name":"Double Click to Install: Create a PKG even your users can install from - N-able","isPartOf":{"@id":"https:\/\/www.n-able.com\/de#website"},"datePublished":"2022-04-06T18:32:54+01:00","dateModified":"2022-10-20T17:24:38+00:00","breadcrumb":{"@id":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.n-able.com\/de\/blog\/create-a-pkg-users-can-double-click-to-install#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Head Nerds","item":"https:\/\/www.n-able.com\/de\/blog\/category\/head-nerds-de"},{"@type":"ListItem","position":2,"name":"Double Click to Install: Create a PKG even your users can install from"}]},{"@type":"WebSite","@id":"https:\/\/www.n-able.com\/de#website","url":"https:\/\/www.n-able.com\/de","name":"N-able","description":"","publisher":{"@id":"https:\/\/www.n-able.com\/de#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.n-able.com\/de?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/www.n-able.com\/de#organization","name":"N-able","url":"https:\/\/www.n-able.com\/de","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.n-able.com\/de#\/schema\/logo\/image\/","url":"https:\/\/www.n-able.com\/wp-content\/uploads\/2021\/02\/logo-n-able-vertical-dark.svg","contentUrl":"https:\/\/www.n-able.com\/wp-content\/uploads\/2021\/02\/logo-n-able-vertical-dark.svg","width":"1024","height":"1024","caption":"N-able"},"image":{"@id":"https:\/\/www.n-able.com\/de#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/NableMSP","https:\/\/x.com\/Nable","https:\/\/www.linkedin.com\/company\/n-able","https:\/\/www.youtube.com\/channel\/UClnp77HHg4aME-S-3fWQhFw"]},{"@type":"Person","@id":"https:\/\/www.n-able.com\/de#\/schema\/person\/f46a000e389b6d02bd4b3866e7828a7b","name":"N-able","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/secure.gravatar.com\/avatar\/e9c468b7c98137ecdd5508befa660c205a7978133257080a37fb0b1362d53411?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9c468b7c98137ecdd5508befa660c205a7978133257080a37fb0b1362d53411?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9c468b7c98137ecdd5508befa660c205a7978133257080a37fb0b1362d53411?s=96&d=mm&r=g","caption":"N-able"}}]}},"_links":{"self":[{"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/posts\/31133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/comments?post=31133"}],"version-history":[{"count":0,"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/posts\/31133\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.n-able.com\/de\/wp-json\/wp\/v2\/media?parent=31133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}