How to automatically unpack a mpkg file on OSX

Xavier Jouvenot
Nov 2, 2020 · 2 min read
Photo by Markus Spiske on Unsplash

I’m Xavier Jouvenot and in this small post, we are going to see how to automatically unpack a mpkg file on OSX.

Self promotion: You can find other articles on my website 😉


When working on CI setup for some projects, I ended up having to install a program on a OSX environment which is only release via a mpkg file.

Since you can only interact with files via command line on such environment, you can’t double click to extract the elements from the mpkg file, so we need to find another way.


After some googling, I finally encountered some articles talking about the command installer, and how it could be used on a mpkg file. Once I had experimented a little bit with this command, I ended with the working following shell instruction:

sudo installer -pkg <path/to/file.mpkg> -target /

Maybe some explanation are necessary :laughing:

I used the sudo keyword since I needed the administrator rights to be able to install the program at the root of computer. Then-pkg flag allows us to specify the location of the mpkg file.

Finally the -target flag allows us to specify where we are going to install the programs contained in the mpkg file. By putting the root of the system (/), we tell the computer that we want our program to be installed into the system part of the computer. Doing this that way, the program I experimented on ended up in the folder/Applications of my machine.

And like that, I have been able to automatically unpack the mpkg file on an OSX system.

Thank you all for reading this article, And until my next article, have a splendid day 😉

Interesting links

Originally published at on November 2, 2020.

Mac O’Clock

The best stories for Apple owners and enthusiasts

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store