# Any way to set preferences programmatically?

**URL:** <https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165>\
**Category:** Questions & Answers\
**Tags:** drracket\
**Created:** [March 24, 2026, 1:00pm UTC](https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165 "2026-03-24T13:00:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToddOBryan](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/toddobryan/32/1962_2.png) [@ToddOBryan](https://racket.discourse.group/u/ToddOBryan)\
**Post date:** [March 24, 2026, 1:00pm UTC](https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165/1 "2026-03-24T13:00:50Z")

</div>

I had an epiphany recently. There are things I want students to have set up whenever they're working on my assignments.

- I love using signatures, but need to include the Image signature and related if I want to do image or universe stuff.
- I want to include some simple definitions. For example, I define \varepsilon to be a small number that students can use as the allowed delta in `check-within`.
- I want coverage turned on.
- I just found the _Parenthesis color scheme_ setting that highlights nested expressions at different levels. (Thank you, JestArray, for showing that on your videos.)
- I'd love for `'()` to displayed as `empty` until I introduce `quote` and `'`, assuming I ever do.

Getting all of these in the same state across computers, students, and environments can be a bit of a pain. One set can be done by `require`-ing a file. Another set requires detailed instructions about setting preferences.

Is there any API for setting preferences in the current running instance of DrRacket? If there were, I could do all of this in a `require`d file, eventually turn it into a package, and keep it updated.

If there isn't, is such a thing even possible? Is it something people would be interested in? It would allow you to save preferred settings as a Racket script that you could run in a new environment. You could have differing preferences depending on what you're trying to do/which language you're working in.

I know the core team has way too much to do already, but this seemed like such a good idea that I wanted to share.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [March 24, 2026, 1:32pm UTC](https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165/2 "2026-03-24T13:32:44Z")

</div>

Use `(find-system-path 'pref-file)` to find the preferences file.  
Then you need to look through to find the keys you need.

```scheme
Welcome to Racket v8.12 [cs].
> (find-system-path 'pref-file) 
#<path:/Users/soegaard/Library/Preferences/org.racket-lang.prefs.rktd>

% head -5 /Users/soegaard/Library/Preferences/org.racket-lang.prefs.rktd
(
 (|plt:DrRacket 7.7-splash-max-width| 996)
 (|plt:DrRacket 7.7.0.4-splash-max-width| 996)
 (|plt:DrRacket 7.7.0.7-splash-max-width| 993)
 (plt:framework-pref:drracket:home/end-is-beginning/end-of-document #t)

```

Most settings are under `drracket` not `DrRacket`.

```scheme
% grep drracket /Users/soegaard/Library/Preferences/org.racket-lang.prefs.rktd | wc -l
     114

```

---

<div class="post-metadata">

**Author:** ![ToddOBryan](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/toddobryan/32/1962_2.png) [@ToddOBryan](https://racket.discourse.group/u/ToddOBryan)\
**Post date:** [March 24, 2026, 2:25pm UTC](https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165/3 "2026-03-24T14:25:23Z")

</div>

Cool. But you can't set them this way, can you? You'd have to do a search and replace and rewrite the whole file?

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [March 24, 2026, 2:55pm UTC](https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165/4 "2026-03-24T14:55:59Z")

</div>

Look at `put-preferences` and `get-preferences`.

---

<div class="post-metadata">

**Author:** ![ToddOBryan](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/toddobryan/32/1962_2.png) [@ToddOBryan](https://racket.discourse.group/u/ToddOBryan)\
**Post date:** [March 24, 2026, 2:58pm UTC](https://racket.discourse.group/t/any-way-to-set-preferences-programmatically/4165/5 "2026-03-24T14:58:24Z")

</div>

OMG. This is awesome. Thanks!
