Showing posts with label osx. Show all posts
Showing posts with label osx. Show all posts

Friday, 31 January 2020

pkgbuild basics - Creating a basic pkg installer on OSX


pkguild is a command-line tool used to create installers, there are easier tools for creating installers such as Packages which uses a graphical user interface.

The way pkgbuild works is that you create a folder structure that acts as the root directory of the target machine, then you move the files for the installer into this fake root folder with the desired folder structure. 
When you run the pkgbuild command you tell it what the root folder is and pkbuild essentially trims off that part of the file path to figure out where to install your files.
The result will be an installer (.pkg file) that will install your files and look something like this:
Image of an installer dialog for example project myapp

In this example I've created a directory called "instroot" in my documents. 
I want "myApp" to be installed at /Applications/myApp so I've copied it to the new folder:
~/Documents/instroot/Applications/MyApp

I also want some text files to be installed at /Library/Application Support/myApp so I've copied them into the new folder too:
~/Documents/instroot/Library/Application Support/myApp/myAppFile1.txt





once all the files for the installer are in the correct place, we just need to call this command:

pkgbuild --root --identifier --version packagename

root: the install root
identifier: an ID for your installer (used only by the operating system and can be anything you want but so try to make it meaningful and unique)
version: the version of your project
packagename: the name for the output installer, the name is also used in the installer dialog

for my example project the command is:

pkgbuild --root ~/Documents/instroot --identifier com.myapp.test --version 1.0 myapp.pkg


We can also use the pkgutil --payload-files command to list the installer files and sanity check the contents.

Now we have an installer called myapp.pkg! Double clicking it will start the installer.





Tuesday, 2 July 2019

Fix for Jenkins on Mac getting stuck on overnight builds




Every night my dutiful Jenkins build servers build their jobs and every morning I come in to find that a job on OSX has gotten stuck on 'git fetch' all night. The job's console output looks something like this:

[EnvInject] - Loading node environment variables.
Building in workspace /Users/me/Projects/MyProject
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Deferred wipeout is used...
[WS-CLEANUP] Done
using credential xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Cloning the remote Git repository
Cloning repository ssh://myname@website.org/repo.git
 > /usr/local/bin/git init /Users/me/Projects/MyProject# timeout=10
Fetching upstream changes from ssh://myname@website.org/repo.git
 > /usr/local/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/local/bin/git fetch --tags --progress ssh://myname@website.org/repo.git +refs/heads/*:refs/remotes/origin/*

Sometimes it starts again while you're looking at it, as if embarrassed to be caught slacking off all night.


Resolution:

This is because I turn off the display in the evening and the OSX build server server decides to go into sleep mode. Here's how to turn that feature off:


  1. Go the the Apple menu, select System Preferences then Energy Saver
  2. Check the box that says "Prevent computer from sleeping automatically when the display is off"

  Azure Trusted Signing Signtool Error SignTool Error: An unexpected internal error has occurred. Error information: "Error: SignerSign...