# Running on Apple M1

**URL:** <https://openrndr.discourse.group/t/running-on-apple-m1/324>\
**Category:** Installation and setup\
**Created:** [January 25, 2022, 7:59am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324 "2022-01-25T07:59:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 25, 2022, 7:59am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/1 "2022-01-25T07:59:12Z")

</div>

I saw that there had been no movement on this issue ([Feature request: Support MacOS ARM · Issue #261 · openrndr/openrndr · GitHub](https://github.com/openrndr/openrndr/issues/261))about M1 support, but it looked like, since there does exist a LWJGL version that supports the M1, this could be an easy change to do my self. However, I was looking at the template project, and I am new to the Gradle build system and couldn’t find where the dependencies are listed. Is there an easy way to locally bump the LWJGL version to get OPENRNDR to run on an M1 mac?

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [January 25, 2022, 8:50am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/2 "2022-01-25T08:50:42Z")

</div>

Hi hi ! Welcome to the forum 🙂

Have you tried with the 0.4 branch?

To try you can do this:

```auto
# build latest openrndr and publish to local maven
git clone https://github.com/openrndr/openrndr
cd openrndr
./gradlew publishToMavenLocal -Prelease.version=0.5.1-SNAPSHOT
cd ..

# build latest orx and publish to local maven
git clone https://github.com/openrndr/orx
cd orx
./gradlew publishToMavenLocal -Prelease.version=0.5.1-SNAPSHOT
cd ..

# clone 0.4 branchn of the template, which uses local maven snapshots by default
git clone https://github.com/openrndr/openrndr-template.git
cd openrndr-template
git checkout openrndr-0.4

```

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 25, 2022, 4:04pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/3 "2022-01-25T16:04:31Z")

</div>

Thanks for the tip! Unfortunately this is the output I get from trying to build openrnder

```auto
> Configure project :openrndr-animatable
Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':kotlinNodeJsSetup'.
> Could not resolve all files for configuration ':detachedConfiguration4'.
   > Could not find org.nodejs:node:14.17.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/org/nodejs/node/14.17.0/node-14.17.0.pom
       - https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-arm64.tar.gz
     Required by:
         project :

```

I have node 14.17.0 installed on my system through `nvm`

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 25, 2022, 6:51pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/4 "2022-01-25T18:51:10Z")

</div>

it seems related to this issue in Kotlin Multiplatform, but again, I’m not sure how to go in and change the relevant configurations to update the reference to the node.js version - [https://youtrack.jetbrains.com/issue/KT-49109](https://youtrack.jetbrains.com/issue/KT-49109)

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [January 25, 2022, 8:36pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/5 "2022-01-25T20:36:34Z")

</div>

Good find. I asked in Slack.

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [January 25, 2022, 8:41pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/6 "2022-01-25T20:41:03Z")

</div>

So until Kotlin 1.6.20 is released, a workaround seems to be adding

```auto
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
    rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "16.0.0"
}

```

into `settings.gradle` in `openrndr`. The issue is that the code above is written in Kotlin (kts) syntax, but `openrndr` so far uses Groovy. Do you know how to write the above in Groovy?

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 26, 2022, 5:37am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/7 "2022-01-26T05:37:41Z")

</div>

I can give it a try but unfortunately i’m not exactly sure what this code means syntactically in kotlin either (it’s my first time picking up both kotlin and gradle). I found this [Migrating build logic from Groovy to Kotlin](https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html) to help, but nothing yet to assist specifically in the kotlin =\> groovy direction

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [January 27, 2022, 11:32am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/8 "2022-01-27T11:32:59Z")

</div>

Maybe [this Chinese website](https://book.kotlincn.net/text/js-project-setup.html) shows how to do it?

```auto
// settings.gradle in openrndr
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin) {
    rootProject.extensions.getByType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension).nodeVersion = "16.0.0"
}

```

Update: in the YouTrack link above they suggested this alternative:

```auto
rootProject.plugins.withType(Class.forName("org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin")) {
    rootProject.extensions.getByType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension.class).nodeVersion = "16.0.0"
}

```

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 31, 2022, 4:21pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/9 "2022-01-31T16:21:57Z")

</div>

Unfortunately that results in the following error:

```auto
FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/avneeshsarwate/openrndr/settings.gradle' line: 42

* What went wrong:
A problem occurred evaluating settings 'openrndr'.
> No such property: plugins for class: org.gradle.initialization.DefaultProjectDescriptor

```

(I think i might just wait for Kotlin 1.6.20 to be release, which i think will have a built in update to the node.js version, just leaving the current state of things in case it’s helpful to anyone else)

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [January 31, 2022, 4:38pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/10 "2022-01-31T16:38:35Z")

</div>

If you’re not bored of trying yet… 🙂 how does your settings.gradle file look like? Something like this?

```auto
rootProject.name = 'openrndr'

rootProject.plugins.withType(Class.forName("org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin")) {
    rootProject.extensions.getByType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension.class).nodeVersion = "16.0.0"
}

include 'openrndr-application',
        'openrndr-core',
        'openrndr-demos',
        'openrndr-draw',
        'openrndr-math',
        'openrndr-color',
        'openrndr-shape',
        'openrndr-event',
        'openrndr-binpack',
        'openrndr-filter',
        'openrndr-svg',
        'openrndr-animatable',
        'openrndr-jvm:openrndr-dialogs',
        'openrndr-jvm:openrndr-ffmpeg',
        'openrndr-jvm:openrndr-ffmpeg-natives-windows',
        'openrndr-jvm:openrndr-ffmpeg-natives-macos',
        'openrndr-jvm:openrndr-ffmpeg-natives-linux-x64',
        'openrndr-jvm:openrndr-ffmpeg-natives-linux-arm64',
        'openrndr-jvm:openrndr-gl3',
        'openrndr-jvm:openrndr-gl3-natives-linux-x64',
        'openrndr-jvm:openrndr-gl3-natives-linux-arm64',
        'openrndr-jvm:openrndr-gl3-natives-macos',
        'openrndr-jvm:openrndr-gl3-natives-macos-arm64',
        'openrndr-jvm:openrndr-gl3-natives-windows',
        'openrndr-jvm:openrndr-openal',
        'openrndr-jvm:openrndr-openal-natives-linux-x64',
        'openrndr-jvm:openrndr-openal-natives-linux-arm64',
        'openrndr-jvm:openrndr-openal-natives-macos',
        'openrndr-jvm:openrndr-openal-natives-macos-arm64',
        'openrndr-jvm:openrndr-openal-natives-windows',
        'openrndr-jvm:openrndr-tessellation',
        'openrndr-js:openrndr-webgl',
        'openrndr-extensions',
        'openrndr-nullgl',
        'openrndr-utils',
        'openrndr-dds',
        'openrndr-kartifex',
        'openrndr-ktessellation'

```

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 31, 2022, 4:42pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/12 "2022-01-31T16:42:45Z")

</div>

Yup - initially had the `plugins` line at the end, and tried with the `plugins` statement after the first line, same issue

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [January 31, 2022, 4:44pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/13 "2022-01-31T16:44:18Z")

</div>

Ok, at least we tried 🙂 If someone mentions other tricks in Slack I’ll share them here. I think another user did use M1 somehow…

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [January 31, 2022, 4:54pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/14 "2022-01-31T16:54:25Z")

</div>

I appreciate all the help!

---

<div class="post-metadata">

**Author:** ![fazwi](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@fazwi](https://openrndr.discourse.group/u/fazwi)\
**Post date:** [February 4, 2022, 9:30am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/15 "2022-02-04T09:30:24Z")

</div>

I managed to make it work !

A bit complicated but here are the steps :

First, following Abe’s comment clone the openrndr and orx projects.

* * *

In the openrndr project

- according to what was said on the slack, copy the changes made in the project : [https://github.com/openrndr/openrndr/compare/master...ink404:m1-support](https://github.com/openrndr/openrndr/compare/master...ink404:m1-support)

- in `openrndr`'s **build.gradle** (not settings) set the node version. _I added this after the plugin declaration but I’m not sure that matters._

```auto
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin) {
	rootProject.kotlinNodeJs.nodeVersion = "16.0.0"
}

```

- build it locally : `./gradlew -Prelease.version=0.5.1-SNAPSHOT publishToMavenLocal`

* * *

In the orx project

- in the **build.gradle** set node version

```auto
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin) {
    rootProject.kotlinNodeJs.nodeVersion = "16.0.0"
}

```

- Make sure `openrndrVersion` is set to `0.5.1-SNAPSHOT` and then build it like : `./gradlew -Prelease.version=0.5.1-SNAPSHOT publishToMavenLocal`

* * *

In the openrndr-template on the master branch:

- change the `openrndrVersion`, `orxVersion` and `ormlVersion` to the `0.5.1-SNAPSHOT`
- add `maven(url="https://oss.sonatype.org/content/repositories/snapshots/")` in repositories.
- On the command line run `./gradlew build` and then `./gradlew run` or use the main function’s green arrow and it works!

Hope this helps

---

<div class="post-metadata">

**Author:** ![avneeshsarwate](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@avneeshsarwate](https://openrndr.discourse.group/u/avneeshsarwate)\
**Post date:** [February 5, 2022, 2:24am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/16 "2022-02-05T02:24:21Z")

</div>

Amazing! this did it! a couple notes:

For those reading later, for the `openrndr-template` changes, the maven repository needs to be done in `settings.gradle.kts`.

Also in that file, i had to set `openrndrUseSnapshot = true` and `orxUseSnapshot = true` - otherwise, the `openrndr-template` project would build, but the TemplateProgram would not run.

Thank you so much for the help!

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [February 5, 2022, 8:01am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/17 "2022-02-05T08:01:56Z")

</div>

Very nice that you made it work! I find it a bit odd to change `lwjglVersion` because master is already using 3.3.0, and `3.3.0-SNAPSHOT` was needed before 3.3.0 was released. Could you try keeping it at

```
lwjglVersion = '3.3.0'

```

and not adding

```
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }

```

? Maybe it works still? Just wondering what’s the minimum change required… 🙂

---

<div class="post-metadata">

**Author:** ![fazwi](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@fazwi](https://openrndr.discourse.group/u/fazwi)\
**Post date:** [February 5, 2022, 12:48pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/18 "2022-02-05T12:48:40Z")

</div>

Yep it works well with keeping lwjglVersion at 3.3.0 and staying with mavenCentral.

But now the issue I have is when trying to use the camera this error is thrown :

```auto
no jniavutil in java.library.path /Users/faw/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:

```

It seems org.bytedeco haven’t released a Mac m1 version of ffmpeg yet…

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [February 5, 2022, 3:02pm UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/19 "2022-02-05T15:02:21Z")

</div>

That sounds more tricky to solve… Either waiting or building your own ffmpeg? No idea where to start with that…

Going back to the steps required to make it work: I wonder if the other two changes from [https://github.com/openrndr/openrndr/compare/master...ink404:m1-support](https://github.com/openrndr/openrndr/compare/master...ink404:m1-support) are required? because they are changing the plain macos version, not the macos-arm64… Could it be that the only thing needed was updating the nodejs version in two files? If that’s the case then we can post a solution (either here or updating the actual source, so it just works… except ffmpeg for now).

---

<div class="post-metadata">

**Author:** ![fazwi](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@fazwi](https://openrndr.discourse.group/u/fazwi)\
**Post date:** [February 7, 2022, 8:58am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/20 "2022-02-07T08:58:42Z")

</div>

Those changes seem needed, if I leave `native-macos` instead of changing it to `native-macos-arm64`, running the simple template throws:

```auto
[LWJGL] Platform/architecture mismatch detected for module: org.lwjgl
        JVM platform:
                macOS aarch64 17.0.2
                OpenJDK 64-Bit Server VM v17.0.2+8-86 by Oracle Corporation
        Platform available on classpath:
                macos/x64
[LWJGL] Failed to load a library. Possible solutions:
        a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
        b) Add the JAR that contains the shared library to the classpath.

```

For ffmpeg in some articles they talk about adding `ffmpeg-platform` as dependency. I also saw that `org.bytedeco.javacpp:1.5.6` starts introducing jars for macOS-arm64. I’ll give it a try later.

---

<div class="post-metadata">

**Author:** ![fazwi](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@fazwi](https://openrndr.discourse.group/u/fazwi)\
**Post date:** [February 10, 2022, 9:38am UTC](https://openrndr.discourse.group/t/running-on-apple-m1/324/21 "2022-02-10T09:38:01Z")

</div>

Managed to make the camera work!  
To do so I needed to install ffmpeg on my Mac.

```bash
brew install ffmpeg

```

Then I had to bump ffmpeg in openrndr’s `build.gradle` to use the 5.0-1.5.7.

line 50-51:

```bash
    javacpp_version = '1.5.7'
    ffmpeg_version = "5.0-$javacpp_version"

```

Then change `openrndr-jvm/openrndr-ffmpeg-natives-macos/build.gradle` to use the arm64 version of the jars.

```nohighlight
dependencies {
    runtimeOnly "org.bytedeco:ffmpeg:$ffmpeg_version:macosx-arm64"
    runtimeOnly "org.bytedeco:javacpp:$javacpp_version:macosx-arm64"
}

```

Due to moving to version 5.0, in `openrndr-jvm/openrndr-ffmpeg/src/main/kotlin/org/openrndr/ffmpeg` some functions used In `AudioDecoder.kt` and `VideoDecoder.kt` became deprecated and needs to be changed.  
I didn’t actually try the audio functionalities, so I’m not sure the following changes are good, but at least it compiles :  
AudioDecoder.kt:123 :

```kotlin
// Replace the following line
// val size = avcodec_decode_audio4(audioCodecContext, audioFrame, frameFinished, packet)
// With the next one
var ret = avcodec.avcodec_send_packet(audioCodecContext, packet)

```

AudioDecoder.kt:183 :

```kotlin
// Change
// val buffer = av_buffer_alloc(audioFrameSize)!!
// To
val buffer = av_buffer_alloc(audioFrameSize.toLong())!!

```

VideoDecoder.kt:141

```kotlin
// Change
// val buffer = av_buffer_alloc(scaledFrameSize)!!
// To
val buffer = av_buffer_alloc(scaledFrameSize.toLong()())!!

```

Recompile the whole thing and it should work!

Also make make sure you run the program through IntelliJ and not command line. If you run gradle through command line the Mac is not going to ask for the camera permissions and if it doesn’t have this permission it will crash.

[Next page](https://openrndr.discourse.group/t/running-on-apple-m1/324.md?page=2)
