Android OS Forum banner

[Utility][10-8-2012] Apk Manager For Mac Os X, Intel Only, v3.0

30293 Views 57 Replies 10 Participants Last post by  jocelyn

So almost everyone here should be pretty familiar with android, and that means you've probably heard of (and maybe even used yourself) the windows tool APK Manager by XDA user Daneshm90.

Earlier this year I started to port the current windows 4.9 version to mac using the outdated linux script for a base. And I had some early success at the time with simply using macports to install sox, optipng, etc. And then my computer crashed (double drive failure back in July, 2011) and I gave up for the time being. Last fall however I was excited to find that someone else tried to do the same thing, XDA user MAD Industries released a very basic port for mac.

Sadly though, a quick diff of his script and the outdated linux version shows that it was still woefully behind the windows version. And so I started working (once again) on my own port of APK Manager for Mac OS X, with my goal to not only bring this current to the windows feature set, but exceed it in many ways.

I've built in 32/64-bit architecture checking, and compiled and include the required missing binaries to re-enable optimizing png images and ogg files. I'm also including a .terminal file for easily configuring the default display, and a copy of my NEW favorite fixed-width font, Bitstream Vera Sans Mono.

And now some notes, and requests:
  • PLEASE note: this is currently INTEL only, but it supports both 32-bit and 64-bit all-in-one with architecture checking built-in to the script.
  • PLEASE note: if your computer is running OS X 10.7.X, "Lion" then it does not include a java runtime by default, please download it here first:
  • PLEASE note: due to the length of some of the strings used in the menus, etc., in order to not need to scroll your terminal window, you must adjust your default columns and rows settings. You can set this automatically by using the include "JocelynCustom.terminal" file, and you can also find simple instructions to set this yourself in the README.txt
  • PLEASE read the included readme for installation and very basic (for right now) usage instructions. I welcome any and all feedback on improvements for the readme file.
  • PLEASE report any and all bugs or generally wonky behavior, preferrably by posting here in this thread, or by posting a comment back on my blog.
  • LASTLY, please if you re-post this anywhere else, including blogs, other forums, etc. I would greatly appreciate if you would at least give me credit, and link back to my blog ( or at the very least, link back here to this post.
DO NOT COPY OVER THE CONTENTS OF THE "other" directory or the root directory unless you absolutely know what you're doing.

IMPORTANT: Please see the second post in this thread for update notes, issues, concerns, etc. thanks :)

Download APK Manager v2.2.5 here: http://www.mediafire...o4idx4en9ldnwx4
Download Migration Tool version v1.4 here: http://www.mediafire...hbhftv9195tk86t
You can find an archive of old versions here: http://www.mediafire.../#idbtn10u3u7nn


May 11, 2012 - beta version of v3.0 is online now on github, if you want to help test it, I suggest backing up your old apk_manager directory entirely, and then going here, and reading the simple install instructions:
  • cd into whatever directory you want the apkmanager folder to be created in, and run:
    git clone [URL=git://]git://[/URL].git
  • launch and follow all the instructions.
Also, git is utterly retarded when it comes to the OSX 'icon' resource files (for custom folder icons) so by default, the folder icon isn't included with 3.0+, but you can download it and apply it yourself still. Link is on the wiki here:

and thank you very much to anyone that helps test this!

Cheers everyone :)
See less See more
  • Like
Reactions: 5
1 - 20 of 58 Posts
5-11-2012 - v3.0 BETA notes

Some notes about the new v3.0 beta released today.

First, please backup your entire old apk_manager directory before you install/clone the 3.0 git repo. My OCD got the better of me when it came to releasing 3.0, and I ended up trashing my entire git repo/history (from v1.0-2.2.5) and starting a new history when I was ~90% through the 3.0 dev process. Because of that, your old directory will cause problems, DO NOT CLONE/INSTALL 3.0b into your old 1.X/2.X directory.

Second, for those comfortable with the command line that really want to help test APK Manager, there are four 'hidden' menu options in most menus (main menu, debug/settings menu, auto-updates menu, signing menu, clean menu) that turn on a variety of debugging options.
  • 96) turns on 'trace mode' (set -x) for the entire script, once the main loop starts. This will make the script basically unusable for people, please only use this if you can reproduce a bug, and are saving the entire terminal output to submit an issue/error log.
  • 97) turns on 'verbose mode' (set -v) for the entire script, once the main loop starts. This will cause some display issues, but the script will remain mostly usable.
  • 98) turns on 'error mode' (set -e) for the entire script, once the main loop starts. This basically causes the script to exit if any condition/test/command fails. Not really useful on its own, but very useful in combination with option 96 or 97.
  • 99) turns on a very (and I do mean VERY) simple debug information display between main apk manager header and most menus. This shows the current PID, the last exit/return code (Currently non-functional) and the last directory change.
So, if you can reproduce any bugs, please close apk manager, and delete your log.txt. Then open APK Manager again, and on the main menu, choose option 98, then next choose option 96. Then reproduce the bug, and copy/paste the entire terminal output into a log on, gist, etc., and send it to me. And of course, if you feel confident debugging and fixing it yourself, then fork the apkmanager repo, and send me a pull request with your changes.

4-14-2012 IMPORTANT!

An update to the issue below. This has been resolved in version 2.1 of APK Manager, and should not present any issues moving forward. However, because the old user settings and private keys were stored locally, inside the apk_manager directory, in order to save these before upgrading, I've created a migration utility/script, that needs to be run before you upgrade.

The link to this migration utility is in the original post in this thread, and the tool is also included in the APK Manager disk image starting with versions 2.1.1.

To run this tool:
  1. mount the "Migration Utility.dmg"
  2. Copy to your old root apk_manager directory.
  3. Copy to your old apk_manager/other directory.
  4. From your old root apk_manager directory, run
  5. Verify that the script completed without any errors
  6. OPTIONAL - for those paranoid, you can double check that it worked manually. Execute the following commands in a terminal:
    cd $HOME<br />
    		ls -la | grep .apkmanager<br />
    		cd .apkmanager<br />
    		ls -la

4-13-2012 IMPORTANT!

AFFECTS all versions of apk manager prior to v2.1 (forthcoming release as of 4/13/2012.)

If you use any advanced signing functionality, you must backup your existing private key(s) and keystore(s) before upgrading to a new version of APK Manager.

Forthcoming version 2.1 will have a separate, automated, one-time backup & upgrade script to run, and all future versions will have automatic backup of key(s) and keystore(s) built in.

By default they get created and saved in the apk_manager/other/.keystores directory. This is a hidden directory by default. You can do one of several different things to unhide/view this directory, and backup your keystore(s).

I'm outlining one simple method here.
  • Enable 'show hidden files' in Finder. From a terminal copy and paste the following two lines:
defaults write AppleShowAllFiles TRUE<br />
killall Finder
  • Finder will restart after those two lines, browse to your apk_manager/other directory and make sure you see the .keystores folder (it should be dimmed compared to regular folders.)
  • Copy this folder and all contents somewhere safe (desktop, user home directory, user backup folder, dropbox, etc.)
  • Proceed with your upgrade (usually just delete the old apk_manager folder and copy over the new one, you might need to manually move project folders, etc. too)
  • Copy/Paste your saved .keystores directory into your new apk_manager/other folder
  • Test advanced signing functionality to ensure everything still works.
  • Once you've verified everything is working, run the following code to turn off viewing all files/folders in finder:
defaults write AppleShowAllFiles FALSE<br />
killall Finder
See less See more
  • Like
Reactions: 2
10/8/2012 - 1:50pm (PST)
  • fixed a couple bugs that were introduced with some changes to homebrew and pngcrush
  • updated smali.jar and baksmali.jar to version 1.4.0
  • fixed a few various typos
  • updated the built-in pngout downloader to download the newest version (May 30, 2012)
  • changed the "view changelog" option on the debug menu to use "git log" if you used homebrew & git to install
  • added the ability to forcibly reset the "home" directory by holding the command/apple key when launching
  • removed all the little "b/beta" tags I could find since this seems good enough for a "real" 3.0 release finally
4/28/2012 - 7:10pm (PST)
  1. v2.2.5 released! - Fixed "adb log" function. I have no idea how or when I broke this, but it was yet another boneheaded mistake.
4/28/2012 - 2:15pm (PST)
  1. v2.2.4 released! - Fixed a bug in the "batch sign with private key" option that would cause the signing process to fail if the key and keystore password weren't identical.
4/24/2012 - 1:25pm (PST)
  1. v2.2.3 released! - I'm retarded and somehow failed to include zipalign in every release. Fixed.
  2. Added zipalign path information to debug/binary info screen.
  3. Replaced all instances/uses of 'which' with 'command -v' instead.
  4. Fixed an obscure bug that could cause infinite loop in the function to check and set png optimization tool.
4/20/2012 - 12:50pm (PST)
  1. v2.2.2 released! - Updated 32-bit optipng to v0.7.1 (Somehow I forgot to update the 32-bit binary when I last updated the 64-bit version)
  2. Minor changes to the way debug/binary version info is scraped and displayed. I personally think this new method is cleaner, and more consistent.
  3. Fixed bug in binary display screen (debug menu, option 2) whereby pressing "any key" did not actually close the screen and return to debug menu.
  4. Updated other/ to dynamically pull the APKManager version banner from whichever other/ version is present, when its run. This should mean the end of unnecessary updates to Migration Utility.dmg, purely to bump the APK Manager version information.
4/17/2012 - 10:10pm (PST)
  1. v2.2.1 released! - Updated pngcrush to 1.7.27 (yep, that's it, lol)
4/16/2012 - 5:15pm (PST)
  1. v2.2 released! - Integrated color scheme selection into one single script, and removed the separate 'black text on light backgrounds' script file since its no longer needed.
  2. Added new option to the "Clean" menu to reset/change color scheme.
  3. Fixed a few obscure bugs with the apktool selection menu.
  4. Added the actual apktool jar file in use to the debug menu information.
  5. Changed the way the default apktool.jar symlink is created in order to prevent APK Manager from ever linking 'mod' versions by default.
  6. Added a new custom icon for the apk_manager folder (CC by-nc-sa) Jocelyn Mallon, 2012
4/15/2012 - 1:35pm (PST)
  1. v2.1.2 released! - Fixed a bug causing decompile/compile errors due to old framework files not being deleted when changing apktool versions.
  2. Added 2 new apktool versions, an upgraded 1.4.2 version, and 1.4.3 ICS Mod. For most instances, 1.4.3 is still the best option to use.
4/14/2012 - 2:20pm (PST)
  1. v2.1.1 released! - Fix brain-dead mistake regarding user settings & private key migration.
  2. Packaged "Migration Utility.dmg" with APK Manager for easier upgrading from previous versions.
4/14/2012 - 1:00am (PST)
  1. v2.1 released! - Migrated user settings and private keys to new location ($HOME/.apkmanager) to ensure preservation when upgrading.
  2. Bumped copyright/CC info in various files to 2012
4/12/2012 - 11:00pm (PST)
  1. v2.0.1 released! - Quick hotfix for directory check/creation for advanced signing options
4/12/2012 - 3:10pm (PST)
  1. v2.0 released! - Re-packaged into a DMG (mac disk image) file to alleviate potential unzip/setup errors.
  2. Updated a lot of the various binaries to latest versions (adb, sox, optipng, pngcrush, etc.)
  3. Added a new option to view java source, this has a lot of potential issues/caveats so please read the CHANGELOG.txt for more information.
  4. Re-worked and (hopefully) simplified debug menu for the millionth time.
  5. Added to list of text editors/viewers
  6. Lots of stuff I probably missed, please read README.txt and CHANGELOG.txt for full details.
10/18/2011 - 7:10pm (PST)
  1. v1.2.1 released! - Mostly bugfixes for a few really stupid bugs I introduced in 1.2. If you had problems running APK Manager because of "missing programs" or "not in PATH" errors (from a clean install) it was my crappy coding skills, and it should be fixed now.
  2. I honestly don't think I added any new features, just bug fixes and code cleanups.
10/10/2011 - 6:35pm (PST)
  1. v1.2 released! Please see CHANGELOG.txt for the comprehensive list of changes. Though I'll list key points here too.
  2. SEVERAL MENU ITEM NUMBERS HAVE CHANGED, please use caution and read every menu before just automatically typing a number from memory. Yeah, I know, I change menu options too often, I apologize for that.
  3. Added another png tool option, pngout. Unfortunately, due to the licensing restrictions, it is illegal to redistribute the actual pngout binary, so instead, APK Manager will download and install the binary upon first attempted use of pngout. This also means that if you never use pngout, it will never be downloaded.
  4. Completely re-worked the adblog.txt function, now completely automated, and, with much clearer instructions.
  5. Added two additional text editor/log viewer options: sublime text 2, and vico. Just like all the rest, they both require command line support to be installed in order to function.
  6. Cleaned up adb shell, ddms, and draw9patch options so that they all now automatically close the new tabs that they open, and when necessary, will kill and re-start adb.
  7. v1.2 might be the last release. I had fun learning how to write shell script for this, but the overwhelming lack of interest in this project has already started to make it no fun for me. And well, its already basically good enough for everyday use, there's just not much else to keep adding.
10/8/2011 - 2:25pm (PST)
  1. v1.1 released! Please see CHANGELOG.txt for the comprehensive list of changes. Though I'll list key points here too.
  2. SEVERAL MENU ITEM NUMBERS HAVE CHANGED, please use caution and read every menu before just automatically typing a number from memory. These should not change again until potentially any major version upgrades.
  3. Re-wrote the way I scrape and store debug/version information, yet again.
  4. switched some code back to a "portable" syntax and changed back to /bin/sh env in case users have a login shell other than bash set.
  5. cleaned up and re-arranged debug menu again, it should be a lot less cluttered, and easier to use overall now.
  6. fixed a few bugs in the startup check, hopefully nobody ever encountered them, they were pretty embarrassing, lol.
  7. added option to choose between optipng and pngcrush for png optimization functions, and the setting is persistent between launches of APK Manager.
10/1/2011 - 1:10pm (PST)
  1. v1.0 released! (finally) Please see CHANGELOG.txt for the comprehensive list of changes. Though I'll list key points here too.
  2. SEVERAL MENU ITEM NUMBERS HAVE CHANGED, please use caution and read every menu before just automatically typing a number from memory. These should not change again until potentially any major version upgrades.
  3. Re-wrote the way I scrape and store debug/version information, this is now persistent between launches, which means that the debug menu will now only be slow on the very first launch, or when forcibly re-building the debug info (using the clean menu) or changing apktool.jar versions.
  4. fixed a bug in the "all-in-one" options that would allow for an invalid keystore selection.
  5. Added a startup check to make sure that the place-here-for-modding, place-here-for-signing, place-here-to-batch-optimize, place-ogg-here, and projects folders all exist, and if they don't, APKManager creates them on launch.
  6. Re-wrote the code to set and select the user-selectable log viewer app.
  7. Added an option for persistent compression level to go along with persistent java heap size.
  8. Changed to pre-pending APKManager specific path items (/other) and also the default /usr/bin to the user $PATH variable, instead of appending them to the end. This insures that we always check the /other directory for binaries, and also that we always use the OSX default unix binaries we need (sed, awk, find, grep, etc.) instead of potentially using any gnu-tools that users may have installed through macports or homebrew.
9/27/2011 - 11:42pm (PST)
  1. v0.9.9 / RC3 uploaded with an utterly insane number of code changes.
  2. added user selectable apktool version (debug menu)
  3. added 4 new editor choices to debug menu (smultron, vi/vim, emacs and nano)
  4. reworked debug menu yet again, and changed the way I gather the debug information for display. This has the upside of speeding up virtually everything in APKManager, including the initial launch. However it has the downside of slowing down the first launch of the debug menu while it builds the debug information. Changing apktool versions is also generally slow, since there's no easy way to scrape just the version information from apktool.jar
  5. added a new "advanced all-in-one" function that will use your selected private key to sign the apps.
  6. a result of the new advanced all-in-one function, (it required completely re-writing the existing decompile, compile, and all-in-one functions) is that everything should be faster now, with less opportunity for error.
  7. added an insane amount of new debug messages to LOG.txt, this is to help both users when having problems with a project, and also with my own bug-hunting.
  8. added the option to launch "draw9patch" (debug menu) and I include all the files necessary, so this does not require the Android SDK to be installed like ddms option does. (I might re-work ddms in the future to not require the SDK too, if possible)
  9. Double, Triple, Quadruple checked error-checking code, and cleaned up, modified, and removed whenever necessary
9/24/2011 - 4:18pm (PST)
  1. v0.9.8.1 uploaded with bugfixes, added macvim and aquamacs to text editor selection, a lot of code tidying up, spelling corrections, etc, a lot of new logging of debug messages, rearranged debug menu display (yet again) to accommodate the new options added.
  2. Changelog has been moved into its own file, CHANGELOG.txt in the root apk_manager directory.
  3. Added option to open CHANGELOG.txt to the debug menu
  4. Actually included the new font this time.
9/23/2011 - 6:0:pm (PST)
  1. v0.9.8 / RC2 uploaded
  2. Fixed the default directory naming (wow that was embarrassing) I'm really sorry about that to anyone that had issues and couldn't figure out why.
  3. Added an entirely new "Advanced Signing Options" menu, this includes the ability to generate and use multiple private keys to sign apk and jar files, options to verify signed files, and batch options for both singing and verifying (with private keys) using the existing "place-here-for-signing" folder structure.
  4. Improved the default "Batch" signing option, should generate proper warnings and errors, and write output to the log file for debugging purposes.
  5. Cleaned up several menus (all menus should have the same general structure now, numeric options starting with the number 1, and using the "Q" to exit or return to previous menu.
  6. Also cleaned up and re-worded some menu text, hopefully all options are clear and easy to understand.
  7. Improved the applescript setup applet yet again, it shouldn't have problems anymore executing commands in proper sequence, though its applescript, so really who knows.
  8. Switched to including the font "BitSteams Vera Sans Mono" not only because it has friendlier copyright/re-distribution rules, but also because it is a phenomenal fixed-width font, my new favorite. You can read about the font online here:
  9. Moved download links to mediafire.
9/21/2011 - 11:49pm (PST)
  1. v0.9.7 uploaded, and I'm calling it RC1!
  2. Improved the applescript setup applet, it should now be quite a bit easier for people to setup and start using APKManager.
  3. Fixed a stupid, nasty bug that I introduced in v0.9.5 and didn't catch until streamlining everything today
  4. Added an "advanced decompile" option that uses baksmali to decompile the code inside an APK, and then uses apktool to only decode the resources. If this option was used, it is automatically detected and handled accordingly when you compile.
  5. Added an option when choosing "adb push" to perform an "advanced" push that does adb shell stop before push, and adb shell start after.
  6. Added an option to open an adb shell session in a new terminal tab (see the debug menu.)
9/20/2011 - 11:32pm (PST)
  1. v0.9.6 uploaded, has error checking to make sure command-line tools for the various text edit options have been installed, else defaults to apple
  2. Added a very basic applescript setup app to automate the creation of a command file that can be double-clicked from the finder to launch APKmanager.
  3. Uhm, I don't even remember anymore... probably broke something?
9/20/2011 - 1:29pm (PST)
  1. FYI, I never uploaded v0.9.4 since it was really late, and had a lot of incomplete code changes.
  2. v0.9.5 uploaded with preliminary support for decompiling and compiling .jar files, persistent java heap setting (see debug menu) bugfixes, yet again various error-checking optimizations, etc, etc, etc.
9/19/2011 - 9:39pm (PST)
  1. v0.9.3 uploaded with bugfixes for some error checking, and new feature to auto-set project apk if only one apk file exists in the "place-apk-here-for-modding" folder.
9/19/2011 - 5:31pm (PST)
  1. v0.9.2 uploaded with ability to setup script as a ".command" file for launching from finder. Please see new Installation instructions in README.txt to enable this.
  2. Tweaked some information on submenus.
  3. Lots of little things I can't remember.
9/19/2011 - 2:00pm (PST)
  1. v0.9.1 uploaded with adb log option, persistent user-selectable text editor support, cleaned up error checking in many places, and I'm sure I've missed something.
  2. added a few extra screenshots to the original post.
9/19/2011 - 12:12am (PST)
  1. v0.9 updated and with quick fix, please re-download.
9/18/2011 - 11:58pm (PST)
  1. v0.9 uploaded with initial support for 32-bit INTEL mac systems, a new debug menu, and a ton of extra error checking.
  2. added download link to main post here on rootz, but I would still please request that you don't link directly to the zip download.
TODO/Pipe-dream: (read: likely to never happen)
  1. Rebuild the Setup/Installer app using Xcode/objective-C. (this probably won't happen.)
  2. Turn this into a graphical Cocoa app for OS X (just like the installer idea above, this will probably never happen.)
  3. add PPC support for older macs
  4. find a better way to handle adb errors (virtually impossible until google supports proper unix exit/error codes)
See less See more
  • Like
Reactions: 1
You made this? Dev tag enroute if so.
b16 said:
You made this? Dev tag enroute if so.

Ok, I've been told that the "DEV" tag does matter, so sure, if that's still an option, I'd be glad to have it.

Anyway, this was originally a really old (and very basic, ~300 lines) linux port of the windows version by Daneshm90 over at XDA.

And since the linux version hasn't been updated in forever, I've ported it to (mostly) proper mac shell syntax, and updated it to match (and in places surpass) most of the windows features. I also built in extensive error-checking behind-the-scenes.

So all in all, this used to be a ~300 line shell script for linux, and its now (well, currently at least) 1751 lines, so I've written over 1400 lines of code for this. I also compiled both 32-bit and 64-bit binaries of p7zip (unix version of 7za) and optipng, and include a 32-bit binary of sox for mac too.

Anyway, thanks in advance.

Cheers, :)
See less See more
New version uploaded...

And I'm retarded, can a mod please move this thread into the "Development Programs" forum?

Cheers :)
you shall no longer see ads, forever.
Add some more options too, kind of like the dsixda kitchen. This would be excellent for the new devs wanting to make some cooked roms.
Looking forward to trying this tonight on the ol' Mac. Thanks!
b16 said:
you shall no longer see ads, forever.

Cheers :)
Definitely going to be trying this out ... Not sure when but I will! lol. Great job on getting something that works for the macs!
Version 1.1 released
version 1.2 released
1.2.1 uploaded with a few bugfixes, please re-download, and I'm really sorry I didn't catch them sooner until someone messaged me today.
I'm rather new to Linux, and have never used Apple. Will this work with Linux, or is it strictly OSX? Thank you.
I'm rather new to Linux, and have never used Apple. Will this work with Linux, or is it strictly OSX? Thank you.

No, this won't work without some tweaking on linux. First of all, the binaries will be totally different for linux than for OSX. Second, there's some use of applescript code inside my script to do things like open new terminal tabs (OSX doesn't have this option from the shell) and that won't work at all on linux.

I'm not opposed to porting this to linux, I just don't have a linux box or the experience with linux to do it. Well, plus I think tommytomatoe has an excellent tool for mac and linux already, search "Android Utility"

See less See more
OP updated with version 2.0!

Re-packaged into a mac disk image (.dmg) to hopefully alleviate some unzip/setup errors. Please see the second post, or the included CHANGELOG.txt for full details of all that has been fixed, added, changed, etc.

Cheers everyone! :)
OP update with v2.0.1, hotfix for advanced signing options, please download the newest version.
Switched around second and third posts in the thread, second post will now include warnings, notes, etc., and third will hold the changelog. Please read notes in the second post before upgrading APK Manager.
OP updated with version 2.1, fixed major bug with saving user settings and private keys. Please make sure to download and run the migration tool before upgrading to v2.1

I'll update the changelog and important notes posts when I wake up.

Cheers everyone :)
1 - 20 of 58 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.