Apple Pkl: A Configuration Language to Replace JSON and YAML

Pkl, pronounced pickle, is Apple's open source configuration-as-code language, with schemas, validation and immutable values. How it compares to JSON and YAML.

Pkl (pronounced “Pickle”) is Apple’s take on configuration-as-code. It sits between traditional formats like JSON and full programming languages like Python, aiming to make configuration more reliable and maintainable.

Here’s what caught my attention about Pkl - it’s not trying to be another general-purpose programming language. Instead, it’s laser-focused on solving one specific problem: making configuration less painful.

As someone who’s wrestled with YAML indentation and JSON’s lack of comments more times than I care to count, I’m intrigued by what Apple is bringing to the table with Pkl.

What Makes Pkl Different?

Configuration files often start simple but grow complex over time. Think about a typical deployment config - it might begin with a few environment variables but evolve into hundreds of lines spanning multiple services. YAML and JSON struggle with this complexity, while general programming languages can be overkill.

Pkl isn’t just another configuration format. It’s a blend between a static config format (like JSON/YAML) and a programming language. Think of it as having the simplicity of YAML but with the power to actually do stuff when you need it.

Pkl
// Basic config
name = "My Service"
port = 8080
// Template for shared settings
baseService {
image = "nginx:1.19"
healthCheck = true
}
// Reuse template for specific services
webService = new baseService {
port = 80
}
apiService = new baseService {
port = 3000
}

The code above shows Pkl’s hybrid nature. It’s as readable as YAML but supports abstraction and reuse like a programming language.

Pkl enforces immutability - once you define a value, it can’t be changed. This prevents a whole class of configuration errors where values get accidentally modified. The language also includes built-in validation through schemas:

Pkl
class DatabaseConfig {
host: String
port: Int
function validate() {
port > 0 && port < 65536
}
}

The schema validates your configuration at evaluation time, catching errors before they reach production.

Pkl is designed to fit into existing workflows. It can output to JSON, YAML, XML, and Java Properties files. This means you can use Pkl to generate configuration for tools that expect these formats. It also offers integration libraries for multiple languages:

  1. JVM (Java and Kotlin)
  2. Swift
  3. Go

These libraries let applications directly read and parse Pkl configurations, eliminating the need for intermediate JSON or YAML files.

Consider a common microservices setup. Each service might need similar but slightly different configuration. In YAML, this often leads to copy-pasted blocks with minor changes. Pkl handles this more elegantly through inheritance and composition.

Pkl
// Base application config with shared defaults
class AppConfig {
port: Int = 8080
logLevel: String = "INFO"
timeout: Duration = Duration.seconds(30)
}
// Specific service config
api = new AppConfig {
port = 3000
timeout = Duration.minutes(2)
}

Do We Really Need Another Language?

I have some reservations about Pkl that warrant discussion. First, introducing a new programming language, even a domain-specific one, brings significant overhead. Every new team member needs to learn it. Every toolchain needs to support it. Every CI/CD pipeline needs to handle it. That’s a lot of friction for something as fundamental as configuration.

The JVM integration also gives me pause. While Pkl claims to be lightweight, requiring a JVM runtime for configuration feels heavy-handed. For simple services or containerized environments where every megabyte counts, this could be a deal-breaker.

There’s also the question of Apple’s long-term commitment. Apple has a history of creating and then abandoning developer tools (remember WebObjects?)

While Pkl is open source, its development appears to be primarily driven by Apple. If they lose interest, the community might not be strong enough to maintain it.

The syntax, while clean, introduces yet another way to do things. We already have YAML, TOML, JSON5, and HCL. Each promised to solve configuration problems, yet here we are with another contender. This fragmentation in the configuration space might actually make things worse, not better.

The validation features, while impressive, could also be achieved with JSON Schema or OpenAPI specifications - tools that already have broad industry adoption and support. Is Pkl really solving problems we can’t solve with existing tools?

Looking at Apple’s own ecosystem, it’s interesting that they primarily use Information Property List and JSON for their platforms’ configuration. If Pkl is such a significant improvement, why isn’t it being used more extensively in Apple’s own products?

Info

Information Property List: A resource containing key-value pairs that identify and configure a bundle.

These concerns don’t invalidate Pkl’s innovations, but they do suggest we should be cautious about adopting it, especially for projects that don’t have Apple’s scale of configuration complexity.

I’m also skeptical about enterprise adoption. Large organizations often have strict requirements about introducing new languages and tools. Convincing security teams to approve a new configuration language - even one from Apple - could be an uphill battle. The risk/reward ratio might not make sense for many businesses, especially when existing solutions, while imperfect, are well understood and have proven security track records.

These aren’t reasons to dismiss Pkl, but they are factors that deserve serious consideration before jumping on board.

The configuration landscape has been stagnant for years, dominated by formats designed decades ago. Pkl represents a fresh approach that acknowledges configuration’s evolution from simple key-value pairs to complex, mission-critical code.

Sources


Trevor I. Lasn

Trevor I. Lasn

Building whiteheap.com and 0xinsider.com.



Related Articles

Check out these related articles that might be useful for you. They cover similar topics and provide additional insights.

Developer tools
5 min read

Mermaid.js is a simple markdown-like script language for generating charts from text via JavaScript

Oct 30, 2019
Read article
Developer tools
20 min read

residue-cli removes a Git worktree only when nothing in it would be lost. How its 15 checks decide, how it deletes and restores, and residue-ui for the Mac.

Nov 9, 2026
Read article
Web performance
6 min read

Lighthouse CI fails your builds when performance drops. I run it on every pull request.

Nov 3, 2025
Read article
Developer tools
13 min read

List of useful Unix terminal commands to boost your productivity. Here are some of my favorites.

Aug 21, 2024
Read article
Developer tools
6 min read

Repomix, formerly Repopack, packs a whole code repository into one file you can share with Claude or ChatGPT. Usage, key features and a word of caution.

Oct 21, 2024
Read article
Node.js
4 min read

Corepack pins the yarn or pnpm version a project uses through packageManager in package.json. Bundled through Node.js 24; on Node.js 25, install it from npm.

Nov 19, 2024
Read article
React
7 min read

Run a React app in Docker: write a Dockerfile, start it with Docker Compose, serve the production build with Nginx and deploy it to a VPS.

Jul 16, 2020
Read article
Developer tools
5 min read

eslint-plugin-depend flags npm packages like is-odd that plain JavaScript replaces. How to install and configure it, and its move to @e18e/eslint-plugin.

Aug 13, 2024
Read article
Security
10 min read

Automate security flows and ensure your team follows security best practices

Aug 6, 2024
Read article

This article was originally published on https://www.trevorlasn.com/blog/pkl-apple-new-configuration-language. It was written by a human and polished using grammar tools for clarity.