I'm trying spacemacs for the first time.

Since I'm on mac, I'd like to change command key as Meta, so I put the following code, and restarted emacs.

It's not working as expected.

When I do Command-x it is recognized as s-x I think it is hyper-x (although I have not used hyper much)

(defun dotspacemacs/layers ()
  "Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
   ;; Base distribution to use. This is a layer contained in the directory
   ;; `+distribution'. For now available distributions are `spacemacs-base'
   ;; or `spacemacs'. (default 'spacemacs)
   dotspacemacs-distribution 'spacemacs
   ;; Lazy installation of layers (i.e. layers are installed only when a file
   ;; with a supported type is opened). Possible values are `all', `unused'
   ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
   ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
   ;; lazy install any layer that support lazy installation even the layers
   ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
   ;; installation feature and you have to explicitly list a layer in the
   ;; variable `dotspacemacs-configuration-layers' to install it.
   ;; (default 'unused)
   dotspacemacs-enable-lazy-installation 'unused
   ;; If non-nil then Spacemacs will ask for confirmation before installing
   ;; a layer lazily. (default t)
   dotspacemacs-ask-for-lazy-installation t
   ;; If non-nil layers with lazy install support are lazy installed.
   ;; List of additional paths where to look for configuration layers.
   ;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
   dotspacemacs-configuration-layer-path '()
   ;; List of configuration layers to load.
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     ;; auto-completion
     ;; better-defaults
     ;; git
     ;; markdown
     ;; org
     ;; (shell :variables
     ;;        shell-default-height 30
     ;;        shell-default-position 'bottom)
     ;; spell-checking
     ;; syntax-checking
     ;; version-control

     (osx :variables
          osx-command-as       'meta
          osx-option-as        'meta
          osx-control-as       'control
          osx-function-as      nil
          osx-right-command-as 'left
          osx-right-option-as  'left
          osx-right-control-as 'left
          osx-swap-option-and-command nil)
   ;; List of additional packages that will be installed without being
   ;; wrapped in a layer. If you need some configuration for these
   ;; packages, then consider creating a layer. You can also put the
   ;; configuration in `dotspacemacs/user-config'.
   dotspacemacs-additional-packages '()
   ;; A list of packages that cannot be updated.
   dotspacemacs-frozen-packages '()
   ;; A list of packages that will not be installed and loaded.
   dotspacemacs-excluded-packages '()
   ;; Defines the behaviour of Spacemacs when installing packages.
   ;; Possible values are `used-only', `used-but-keep-unused' and `all'.
   ;; `used-only' installs only explicitly used packages and uninstall any
   ;; unused packages as well as their unused dependencies.
   ;; `used-but-keep-unused' installs only the used packages but won't uninstall
   ;; them if they become unused. `all' installs *all* packages supported by
   ;; Spacemacs and never uninstall them. (default is `used-only')

   dotspacemacs-install-packages 'used-only)

  • What happens when you replace the variables osx-command-as, osx-option-as, and osx-control-as with osx-left-command-as, osx-left-option-as, and osx-left-control-as, respectively? I'm not sure how much experience you have with Emacs, but M-x describe-key (or the binding C-h k) will show you the modifier mapped to the key pressed immediately afterward. So you can press e.g. Command a and note the text displayed in the echo area. The letters C, M,
    – Pablo
    Mar 23, 2021 at 14:28
  • fwiw, I'm in the same boat: I want to swap option and meta. However, I don't want osx keybindings throughout, just to swap those two keys. This layer is not the right choice for this. I wish I knew what is.
    – taranaki
    Aug 31, 2021 at 1:43

1 Answer 1


You're not giving enough information to help debug: from details of the errors you're seeing to what version of Spacemacs you have installed. I have just installed a clean Spacemacs repo (the develop branch), added osx layer to dotspacemacs-configuration-layers (with no layer variables), and had no problems.

The osx layer maps Cmd key to Hyper since commit 2215ffe68 because of various possible issues when using Alt or Super. They also don't recommend mapping it to Meta -- see the commit message for details.

Also note that the layer maps most but not all the standard macOS key bindings: the one that I noticed right away was Cmd-o to open a file. I just bind it to ((kbd-mac-command "o") . counsel-find-file) in my config.

I'd suggest you give it a another try by checking out the develop branch of Spacemacs, but with just osx with no layer vars in your dotspacemacs-configuration-layers. Report here if you see any errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.