New project announcement
I shipped skillcraft.ai - a tool that helps you find the best learning resources tailored to your goals. All you need to do is tell it what you want to learn, and I’ll find the right resources to get you there.
Up to date
Published
4 min read

Trevor I. Lasn

Building tools for developers. Currently building skillcraft.ai and blamesteve.lol

Pkl: Apple's New Configuration Language That Could Replace JSON and YAML

A deep dive into Pkl, Apple's configuration language that aims to replace 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?

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


Found this article helpful? You might enjoy my free newsletter. I share dev tips and insights to help you grow your coding skills and advance your tech career.


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

Tech
5 min read

The Fight to Free JavaScript from Oracle's Control

The creator of JavaScript and Node.js are challenging Oracle's control over the JavaScript name

Nov 23, 2024
Read article
Tech
3 min read

You Don't Own Your Social Media Accounts

Social platforms promise exposure but quietly hold your audience hostage

Nov 28, 2024
Read article
Tech
5 min read

Can OSSPledge Fix Open Source Sustainability?

The Open Source Pledge aims to address open source sustainability challenges by encouraging companies to pay $2,000 per developer per year

Nov 17, 2024
Read article
Tech
2 min read

Google's AI distribution advantage

While everyone debates models and features, Google owns the distribution channels that make AI stick

Jul 25, 2025
Read article
Tech
4 min read

When Regex Goes Wrong

Issues and catastrophic failures caused by regex

Aug 29, 2024
Read article
Tech
4 min read

Chrome Is Beta Testing Built-In AI. Could This Kill a Lot of Startups?

The Power Play: Gemini Nano in Chrome

Aug 31, 2024
Read article
Tech
5 min read

Cloudflare Study: 39% of Companies Losing Control of Their IT and Security Environment

New research reveals a shocking loss of control in corporate IT environments

Oct 3, 2024
Read article
Tech
3 min read

Ghost Jobs Should Be Illegal

How fake job postings became a systemic problem in tech recruiting

Nov 15, 2024
Read article
Tech
10 min read

Amazon's Rise to Tech Titan: A Story of Relentless Innovation

How Jeff Bezos' 'Day 1' philosophy turned an online bookstore into a global powerhouse

Sep 30, 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.