Updates:
Before you the method in this post, try XG’s suggestion to restart in safe mode.
This method in this post requires trial and error if you have lot of displays. Konstantin Gredeskoul has created an automated bash script and shared it on GitHub. Check his comment.
Or directly go to GitHub for instructions: Changing OSX Underscan
I recently purchased an Asus external monitor. The first thing I noticed on plugging it to my MacBook was that there was a blank space at each of the edges. This wasted quite a bit of screen estate and also made everything blurry. This can generally happen due to wrong underscan/overscan settings.
On testing monitor with other laptops, I found that it was working fine. So it was something with my Mac. macOS has a slider to adjust overscan in system preferences. However, it only appears for TVs. So it was not appearing for me.
It took me two hours but I finally fixed it with help of command line and Stack Overflow.
The Stack Overflow question: “How to reload .com.apple.iokit.graphics underscan without restarting?”. This was unrelated to my problem but helped me to find the file where configuration is stored.
In case you encounter same issue, here’s a step by step guide to save you a couple of hours:
Disclaimer: You may damage your system with a wrong command, so proceed with caution. I am just sharing what worked for me and am not responsible for any loss or harm caused by anything in this post. It worked for me on a MacBook Pro (Retina, 13-inch, Early 2015) running macOS High Sierra (10.13.2), it may or may not work for you.
Fixing Overscan/Underscan
- Open terminal.
- You want to open
/var/db/.com.apple.iokit.graphics
file. To do that, enter following command in terminal:
sudo open -a TextEdit /var/db/.com.apple.iokit.graphics
- TextEdit will open with the file. You’ll notice that the file has following structure:
- Starting with line 5, every
key
tag is a separate display and followingdict
is list of preferences for it. - Note: You may need to do a bit of trial and error to find the correct display. In my case, I only use a limited number of displays, so I reset the settings for every display, restarted and it was fixed.
- Find the lines that say
<key>pscn</key>
. This is the preference that controls underscan/overscan. - Next line after every
pscn
key will look like this:<integer>10000</integer>
(line 34 above). - 10000 means that there is no underscan. Value less than 10000 means that display will be underscanned, larger value means it is overscanned.
- For values less than 10000, change them back to 10000.
- Save the file, you may need to enter your admin password.
- Restart.
The issue should be fixed. I hope it will save some time for you. In meantime, if you find any shortcuts, do let me know via comments.
Ishan, thank you so much for posting this! It was a lifesaver for me, as I am forced to work on a very crappy Samsung monitor for a week that does not have any buttons, besides the power button LOL!
I wanted to add one additional hint on how to determine which monitor is the the one that needs to be changed. Below commands are all run from the terminal:
? grep pscn /var/db/.com.apple.iokit.graphics | wc -l
58
This tells me that I had 58 monitor entries! How to tell which one is the crappy monitor I use?
Here is what I did to figure this out:
1) Make a backup of the current file:
? cp /var/db/.com.apple.iokit.graphics /tmp/.com.apple.iokit.graphics.backup
2) With the “troubled” monitor connected, open DIsplay Preferences, and change it’s settings: for example, I changed it’s resolution from 1080p to 1080i. It doesn’t matter what you change, as long as you change something and specifically for that monitor.
3) Run the “diff” command to see what had changed in that file after you made the changes:
? diff /var/db/.com.apple.iokit.graphics /tmp/.com.apple.iokit.graphics.backup
195c195
AAAAAAA….
(I shortened the lines for readability). The only part we care about is shown on the very first line: 195. This is the line number where the change happened after you modified your monitor settings. In my case, the value for `pscn` was three lines above 195, i.e. at line 192.
Now it’s time to follow your instructions, open the file in an editor, then scroll to line 192, then go up a few lines to find the `pscn` and edit it.
Don’t forget to exit display settings before changing it, and then restart.
Finally, I’ve tried to automate this process in a helpful script, documented here:
https://github.com/pioneerworks/lib-bash#changing-osx-underscan-for-old-monitors
Thanks again!
Wow. That script is amazing. Thank you for sharing this. I have added a note to top of the post about this.
You are welcome! I just extracted it so that it’s standalone and requires no dependencies:
https://gist.github.com/kigster/7ce9e879883cf4899fa0de94a57dfaf0
Thanks again!
Thank you it worked. My file was locked so I had to save a copy to my desktop. Then I had to enable hidden files (I googled how to do that) and it showed the new copy on my desktop and the old copy on “open /var/db” so I replaced it and kept the original file name (had to change it form “copy” to “graphics” at the end. Restarted computer and it worked.
Hi,
I had the same problem and was able to fix it with the help of this post, So thank you !
But I wish to put my 2 cents to this problem so I tried a few things and I maybe have a quicker solution…
If you just delete the .com.apple.iokit.graphics file then restart Mac OS will create a new default one and voilà problem solved !
Hi Pascal,
Thank you for sharing. In my case, I had tried deleting that file but that didn’t work for me.
a year later…
Thanks Ishan and Pascal, I deleted the file and it worked perfectly thanks, you guys are breathtaking!!!
i typed “open -a TextEdit .com.apple.iokit.graphics” into terminal and it said the file does not exist.
I tried searching for it on finder/spotlight trying several different keywords and phrases. I couldn’t find the file.
could someone help?
Hi,
The file is in /var/db, so either you need to use
open -a TextEdit /var/db/.com.apple.iokit.graphics
or usecd /var/db/
and then run the command I mentioned in step 2.Thanks.
Thanks Ishan, I tried a lot of troubleshooting and nothing worked, this was a big relief!
Hello Ishan first of all thank you for this post.
In my case (mac mini with High Sierra 10.13.5 monitor HP 2309m) the command open -a TextEdit /var/db/.com.apple.iokit.graphics do not allow me to edit the file even modifying the permissions.
I tried with sudo open -a TextEdit /var/db/.com.apple.iokit.graphics but don’t works 🙁
I resolved with the vi program
sudo vi /var/db/.com.apple.iokit.graphics
In my case just value is about 9500
Wow! It works! Thanks a lot !!!
By by
Paolo
Thank you. Not really sure what would cause this. I included TextEdit because that’s generally easier to use for non-programmers (I had used Sublime Text).
Glad that it worked for you.
That’s because text edit can’t rewrite certain files, but vim can overwrite the original and leave it there in the same location which is what we want here in the first place
This is the second time I had to fix the underscan. First time was for upgrading to sierra with my stock gpu that came with my mac pro 2010 dual 8 core. I followed the original instructions but I don’t think making a duplicate of the original and editing it and then replacing it fixed it because the .com is reserved and lock for the original…it took a couple of tries but it fixed it self from after a couple of restarts and safe boot..is what I think fixed it the first time.
But this time I upgraded my GPU to a MSI rx560 and the underscan issue came back!!
So I repeated the process instructed by your blog by duplicating the original .com.apple.iokit.graphics in text edit to rewrite and replaced it in the db folder but it didn’t work after two hours of trying, no luck I also tried nano by that didn’t work form….Then I used Vim and it worked!!!!
Thanks for the tip Paolo…worked like a charm
I have a Asus ProArt 329Q. I have tried your method but after a restart, the oscn value is always back to 1.
If I set the resolution to 3840×[email protected], the top menu is cut off by about half its height.
If I set the resoltuion to 3840×[email protected], it’s fine.
If I hit the overscan checkmark (on), it disappears completely and reappears only after a restart. Weird stuff.
That’s some weird behavior. Unfortunately, I don’t have that monitor and am not really sure if there’s anything I can do to help here.
Hey, maybe you can help me. I tried, but I can’t edit the file because I don’t have the rights. I have an admin account macOS 10.13.6. I disabled SIP and changed all rights to read and write. But there is always the message that I can not edit the date, but only a copy of it. I’ve been looking for a way to use underscan on one of my monitors for ages. Any ideas?
You shouldn’t need to disable SIP. Does opening from terminal with
sudo
not work?Hi I tried to access the file on my mac and it seems to say that the file is locked and i cant edit it and i cant seem to fine the file anywhere else as well… any advise on this issue?
Hi Kelvin,
Did you try opening file from the terminal with
sudo
?My file is also locked… I obviously used sudo to force it, the document opens but I cant edit it. My mac wants me to duplicate the document instead of directly editing it.
Hello, I have the exact same problem and I used sudo.
Can you try copying the file to desktop, removing the old file and then pasting new one in
/var/db/
? To open the hidden folder, just enteropen /var/db/
in terminal.I have the same problem i opend it with the command
sudo open -a TextEdit /var/db/.com.apple.iokit.graphics
but it says its locked.
what can i do?
My file is also locked… I obviously used sudo to force it, the document opens but I cant edit it. My mac wants me to duplicate the document instead of directly editing it.
Can you try copying the file to desktop, removing the old file and then pasting new one in
/var/db/
? To open the hidden folder, just enteropen /var/db/
in terminal.I have the same problem i opend it with the command
sudo open -a TextEdit /var/db/.com.apple.iokit.graphics
How to fix this?
Can you try copying the file to desktop, removing the old file and then pasting new one in
/var/db/
? To open the hidden folder, just enteropen /var/db/
in terminal.I have the same issue. I opened the hidden folder, but unfortunately the file is hidden too. Is there a way to show it and replace it?
I have the same problem. After typing open /var/db/ in terminal, in which folder exactly I have to remove the old file and replace it with the new one saved in desktop? Thanks!
Hello!
I am able to get it to work. However, every time that I turn my monitor off it requires that I repeat the full process even when the information is saved. Know of any fix for this? Thanks.
You sir are the best.
Thank you so much, I was gonna sell my screen after months of aggression towards it.
I wish you all the good things in this world!
Ran into this same underscan problem with black borders showing up on my new Dell 24-inch Ultrasharp U2415 connected to a 2013 Macbook Air running High Sierra, and after hours of looking into the problem the fix turned out to be super simple:
Just restart in Safe Mode.
That’s it. Restart your Mac in Safe Mode (restart, hold down the Shift key after the Apple BONG sounds, then restart normally once again for good measure. I don’t know what this clears or resets but it worked for me. No more letterboxing or black borders with the native 1920×1200 resolution selected.
So maybe something to try first for anyone coming across this post.
Thanks for the comment and great suggestion. The post is a bit old so I don’t remember if I did start in safe mode (I think I did and it didn’t work), but I will add it to the post.
It worked! Just safe mode and restart! Thank you very much after a day of playing around…
Hey XG,
Many thanks!!!. I have restarted my 2017 Mac in safe mode. Lo and behold my DELL Monitor got filled completely without any Underscan issue.
Thanks Ishan.
BR,
Kalyan
Thank you very much for your post! It really helped me to solve my problem.
I just had to perform a different step in changing the value on the file. I had to open the file with “nano” in order to modify it because using “textedit” was getting it locked.
Thank you so much for your post! It fixed underscan problem on my Dell U2713H.
I was just need to disable the macOS’s system integrity protection (SIP) before editing the config file.
how do you paste to /var/db/
Thank you so much! You solved my problem!!!
This post is a LIFE SAVER!!!! I’ve been going crazy for the last couple hours trying to fix this shit!
This seem to be really helpful to others. To me as well but it didn’t fix my underscan.
This is what mine looks like (after some tinkering).
I have noticed that I have “oscn” which means overscan, unlike yours, “pscn”.
Never mind the 12000. Tried editing it, didn’t do anything. The only thing that seems to do anything was the oscn which can be either 1 or 2, yes or no. Just a toggle, can’t adjust.
IOService:/AppleACPIPlatformExpert/[email protected]/AppleACPIPCI/[email protected],1/IOPP/[email protected]/NVDA,[email protected]/NVDA/display0/AppleDisplay-3674-30
oscn
0
pscn
12000
startup-timing
AAAAAAAAAMAAAAAAAAAAAAAAAAB4AAAAQgAAAAAAAACABwAAOAQAAAAAAAAA
AAAAIO7ZCAAAAAAg7tkIAAAAACDu2QgAAAAAgAcAABgBAABYAAAALAAAADgE
AAAtAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAA
AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
version
2
Fantastic, this seems to works for me. Fingers crossed for now.
Seems that using TextEdit on Mojave will fail saying the file isn’t owned by the user. Using Vim as superuser worked, however.
Thanks worked a treat dropping it down to about 8800. Ive some overscan now instead of underscan on my old 30inch Dell via HDMI but more than happy!
Thanks so much
Hey, thanks for this fix – it worked for me, although I used vi to edit the file.
Why can’t Apple can’t just stick the underscan option in the display settings!
oscn
1
I have this in my file when I make it 0 it’s underscan and 1 on overscan I tried 0.5 but it dint work so what should I do?
Great solution, it helped me alot, I just used the file name to locate it in finder then deleted it and restarted my mac and all fixed.
I opened my finder at root level by selecting locations and the MacBook if not shown just enable it from preferences-Sidebar then enable it from Locations
press Command + Shift + Period this character . and navigate to var/db and find the .com.apple.iokit.graphics file and delete it after entering your password.
Restart and Voilà.
Wow!
You guys saved my ass!
sudo rm- rf /var/db/.com.apple.iokit.graphics
reboot
BAM!