1diff --git a/src/main-executable/main.c b/src/main-executable/main.c
2index 545da00f..2f87447d 100644
3--- a/src/main-executable/main.c
4+++ b/src/main-executable/main.c
5@@ -390,7 +390,10 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h
6
7 ret = stat(MICROG_APK_PATH_LOCAL, &dont_care);
8 errno_localdir = errno;
9- if (!ret) {
10+ char *env_microg = getenv("MICROG_APK_PATH");
11+ if (env_microg && access(env_microg, F_OK) == 0) {
12+ microg_apk = strdup(env_microg);
13+ } else if (stat(MICROG_APK_PATH_LOCAL, &dont_care) == 0) {
14 microg_apk = strdup(MICROG_APK_PATH_LOCAL); // for running out of builddir; using strdup so we can always safely call free on this
15 } else {
16 char *microg_install_dir = malloc(strlen(dex_install_dir) + strlen(REL_MICROG_APK_INSTALL_PATH) + 1); // +1 for NULL