Got errors when changing a readonly file (the CSS of pop-out dictionary) on OS X When I tried to edit a CSS file to adjust the pop-out font through vim in terminal, I got
W10: Warning: Changing a readonly file. Thinking sudo could be used to tackle that, I went editing the file anyway. 

body {font-size: 12pt;} → body {font-size: 14pt;}


But then I couldn't save the change. 
I tried a command suggested online :w !sudo tee % and got 

/bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 1: syntax error: unexpected end of file

shell returned 2


How to improve that command?

/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/3300e8c78ceb9a7ceeb617334b1df9018e6b46b8.asset/AssetData/Oxford\ American\ Writer\'s\ Thesaurus.dictionary/Contents/Resources/DefaultStyle.css

macOS Sierra 10.12.6
You're attempting to edit a file within a restricted location, protected by System Integrity Protection.

$ ls -O /System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX
total 104
drwxr-xr-x   7 root  wheel  restricted  224B 19 Apr 09:29 ./
drwxr-xr-x@ 24 root  wheel  restricted  768B 31 Mar 12:15 ../
drwxr-xr-x   5 root  wheel  restricted  160B 31 Mar 12:19 2fcc349eb53d7c336b8372758b70508eb8e2ac0b.asset/
drwxr-xr-x   5 root  wheel  restricted  160B 31 Mar 12:19 61b49f47f0dce1c061c688d415e1f1a84c37fce0.asset/
drwxr-xr-x   5 root  wheel  restricted  160B 31 Mar 12:19 cd4d7cc1cd227a13d2b9c029f86c940f94b7543a.asset/
-rw-r--r--   1 root  wheel  restricted  3.4K 19 Apr 09:29 com_apple_MobileAsset_DictionaryServices_dictionaryOSX.plist
-rw-r--r--   1 root  wheel  restricted   44K 19 Apr 09:29 com_apple_MobileAsset_DictionaryServices_dictionaryOSX.xml

These cannot be edited even with sudo. To edit files within restricted locations, either:

Perform the edit from Recovery HD.

Boot into the Recovery HD by restarting whilst holding ⌘R.
Use the Terminal from the Utilities menu in Recovery to perform the edit. Note that / is the mount point of the recovery environment, therefore you should access your disk from /Volumes/yourdiskname/….
Reboot


Disable System Integrity Protection, perform the edit, then re-enable it.


Boot into the Recovery HD by restarting whilst holding ⌘R.

Open Terminal (from the Utilities menu).

Run the following command in Terminal:
 csrutil disable


Restart.




Perform the edit you wish to make to the files.

Boot into Recovery HD once more and run csrutil enable to re-enable SIP.