Skip to content

Instantly share code, notes, and snippets.

@rtrouton
rtrouton / pkg_cheatsheet.md
Created November 14, 2022 22:00
Working with Apple pkgs

Mac Packaging Cheatsheet

Create a component pkg from a DMG

pkgbuild --component /Volumes/ApplicationName/*.app --install-location \
    /Applications ApplicationName-Version.pkg

Install pkg from command line

sysadminctl is a tool Apple introduced in 10.10 for working with system user accounts. In 10.13,
sysadminctl is Apple's recommended tool for working with user accounts in the CLI, replacing functionality
that has long been provided by dscl and adds new features available only in 10.13.
sysadminctl can be used to change user passwords, create new users (including automatically provisioning
the user home folder) or check the status of a new-to-10.13 security feature named SecureToken.
SecureToken is a user attribute like password type or user home location. SecureToken is not publicly
documented by Apple so it is not possible to provide a full technical description, but in practice one
needs only to know if a user has SecureToken or not. Having SecureToken set signifies that a user can
unlock a FileVault-encrypted volume. Without the SecureToken bit on a user account, that user will not
@rtrouton
rtrouton / DisableAllPoliciesInCategory.sh
Created November 17, 2017 20:18
This script disables all polices in a specified category on a Jamf Pro server
#!/bin/bash
clear
# This script enables all polices in a specified category
# Script is adapted from purgeAllPoliciesInCategory.bash by Jeffrey Compton, https://twitter.com/igeekjsc
# https://github.com/igeekjsc/JSSAPIScripts/blob/master/purgeAllPoliciesInCategory.bash
#Authenticate
read -p "Please enter your JSS URL (e.g. https://myJSS.myCompany.com:8443/) : " jssURL
@rtrouton
rtrouton / EnableAllPoliciesInCategory.sh
Created November 17, 2017 20:18
This script enables all polices in a specified category on a Jamf Pro server
#!/bin/bash
clear
# This script enables all polices in a specified category
# Script is adapted from purgeAllPoliciesInCategory.bash by Jeffrey Compton, https://twitter.com/igeekjsc
# https://github.com/igeekjsc/JSSAPIScripts/blob/master/purgeAllPoliciesInCategory.bash
#Authenticate
read -p "Please enter your JSS URL (e.g. https://myJSS.myCompany.com:8443/) : " jssURL
@rtrouton
rtrouton / gist:cc3130e314ecb4f4284e05c9f17fd4fc
Created April 28, 2017 16:14
Xcode watchOS simulator download URLs (as of Xcode 8.3.1)
watchOS 2.2 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.WatchSimulatorSDK2_2-2.2.1.1460407064.dmg
watchOS 2.1 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.WatchSimulatorSDK2_1-2.1.1.1451948363.dmg
watchOS 2.0 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.WatchSimulatorSDK2_0-2.0.1.1446084258.dmg
@rtrouton
rtrouton / gist:9a90b10c669323df65eec8eb8956cc5d
Created April 28, 2017 16:14
Xcode tvOS simulator download URLs (as of Xcode 8.3.1)
tvOS 10.1 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.AppleTVSimulatorSDK10_1-10.1.1.1484185528.dmg
tvOS 10.0 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.AppleTVSimulatorSDK10_0-10.0.1.1474488730.dmg
tvOS 9.2 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.AppleTVSimulatorSDK9_2-9.2.1.1460407064.dmg
tvOS 9.1 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.AppleTVSimulatorSDK9_1-9.1.1.1451953694.dmg
tvOS 9.0 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.AppleTVSimulatorSDK9_0-9.0.1.1446152618.dmg
@rtrouton
rtrouton / gist:2ca6f001b3cecb5037825c7f9d2e422e
Created April 28, 2017 16:13
Xcode iOS simulator download URLs (as of Xcode 8.3.1)
iOS 10.2 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_2-10.2.1.1484185528.dmg
iOS 10.1 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_1-10.1.1.1476902849.dmg
iOS 10.0 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_0-10.0.1.1474488730.dmg
iOS 9.3 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg
iOS 9.2 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg
iOS 9.1 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_1-9.1.1.1446593668.dmg
iOS 9.0 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_0-9.0.1.1443554484.dmg
iOS 8.4 Simulator: https://devimages.a

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this:
@rtrouton
rtrouton / resize_vm_boot_partition.sh
Created March 3, 2017 21:01
Resize boot volume using diskutil to occupy all available space on the partition
#!/bin/bash
# Resize boot volume to occupy all available space on the partition
/usr/sbin/diskutil resizeVolume / R
@rtrouton
rtrouton / gist:3ac68ac3770ab23ebae354c581f526b7
Last active April 23, 2024 01:17
MigrateADMobileAccountToLocalAccount.command script
#!/bin/bash
# Modified 4/5/2019
Version=1.4
# Original source is from MigrateUserHomeToDomainAcct.sh
# Written by Patrick Gallagher - https://twitter.com/patgmac
#
# Guidance and inspiration from Lisa Davies:
# http://lisacherie.com/?p=239
#
# Modified by Rich Trouton