Building Aseprite from Source | macOS

Build the pixel art tool "Aseprite" from the source code on Mac.

Introduction

The pixel art tool Aseprite is sold commercially on Steam, but its source code is publicly available, allowing you to build it for free.

GitHub - aseprite/aseprite: Animated sprite editor & pixel art tool (Windows, macOS, Linux)

This post records the process of building Aseprite from the source code.

# The working environment is an M2 Mac:
- MacBook Air
- Chip: Apple M2
- macOS: Sonoma 14.0
- Memory: 16 GB

Note: This article was translated from my original post.

Building Aseprite from Source

Following the official guide.

aseprite/INSTALL.md at main · aseprite/aseprite · GitHub

Getting the Aseprite Source Code

First, get the Aseprite source code and enter the directory.

git clone --recursive https://github.com/aseprite/aseprite.git
cd aseprite

Required Libraries

Next, install the required dependencies.

Common dependencies:

macOS-specific dependencies:

  • Xcode 13.1 or higher
  • macOS 11.3 SDK or higher

Let's install them step by step.


Install CMake and Ninja via Homebrew:

brew install cmake
brew install ninja


Next, download and extract the appropriate Skia release binary.

The target file depends on the OS and architecture (Apple Silicon or not). Since I'm using an Apple Silicon Mac, I downloaded the corresponding version. If your environment differs, find the appropriate version on the release page and adjust accordingly.

curl -O -L "https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-macOS-Release-arm64.zip"
unzip Skia-macOS-Release-arm64.zip -d skia-m102


Finally, Check your Xcode and SDK versions using the following commands:

# Check Xcode version:
xcodebuild -version

# Check SDK version:
xcodebuild -showsdks

If the versions do not meet the requirements, update accordingly.

Compilation

Now, let's compile the Aseprite code.

At this stage, you should be in the root directory of the cloned Aseprite repository (move there if necessary).

# The directory should look like this:
$ ls
CMakeLists.txt          EULA.txt           cmake           skia-m102
CODEOWNERS              INSTALL.md         data            src
CODE_OF_CONDUCT.md      README.md          docs            tests
CONTRIBUTING.md         Skia-macOS-Release-arm64.zip laf    third_party


Create a build directory and navigate into it. All build processes will be executed inside this directory.

mkdir build
cd build


Next, run cmake. The command varies depending on the OS and architecture (Apple Silicon or not).

For an Apple Silicon Mac, use the following command. For other environments, refer to the official guide.

cmake \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_OSX_ARCHITECTURES=arm64 \
  -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
  -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
  -DLAF_BACKEND=skia \
  -DSKIA_DIR=../skia-m102 \
  -DSKIA_LIBRARY_DIR=../skia-m102/out/Release-arm64 \
  -DSKIA_LIBRARY=../skia-m102/out/Release-arm64/libskia.a \
  -DPNG_ARM_NEON:STRING=on \
  -G Ninja \
  ..


After running cmake, compile with ninja:

ninja aseprite

If the process completes successfully, the executable should be available at ./bin/aseprite within the build directory.

Double-click the file in Finder to launch Aseprite.

Aseprite executable generated

Aseprite successfully launched

Appendix: Running Aseprite as an Application

While Aseprite can now be launched from the executable file, a bit more work is needed to make it a standard Mac application.

From the build directory, run the following commands to create an .app bundle in /Applications/:

# Create Aseprite.app and copy necessary files
mkdir -p Aseprite.app/Contents
cp -r ./bin ./Aseprite.app/Contents/
mv ./Aseprite.app/Contents/bin ./Aseprite.app/Contents/MacOS

# The folder structure should now look like this:
# $ tree -L 3 Aseprite.app
# Aseprite.app
# └── Contents
#     └── MacOS
#         ├── aseprite
#         ├── data
#         └── gen

# Move it to /Applications
sudo cp -r ./Aseprite.app /Applications/

Now, you can launch Aseprite by double-clicking Aseprite.app in the Applications folder. You can also pin it to the Dock like any other application.

Conclusion

That's it! We successfully built Aseprite from the source code.

I was worried about compatibility with the M2 Mac, but everything worked fine.

I hope this helps someone!

[Related Articles]

en.bioerrorlog.work

References