The control for command blocks depends on your Minecraft version. Check the matching instructions below.

Turn them on

  1. Check the server version. Stop it before editing the older properties file; game-rule commands run from the live console.
  2. On 1.21.8 and earlier, set enable-command-block=true in server.properties. For 1.21.9–1.21.10, use gamerule commandBlocksEnabled true while the server is running. For 1.21.11 and newer, including 26.x, use gamerule minecraft:command_blocks_work true.
  3. If you edited the properties file, save it and start the server. A game-rule change takes effect immediately.

Get a command block

Command blocks aren't in the creative inventory. As an op in creative mode, run:

/give @s command_block

You also need to be an op (permission level 2 or higher) to edit what's inside a command block.

Stop command block messages filling the chat. By default, ops see a chat message every time a command block runs. Turn that off with gamerule command_block_output false. On versions before 1.21.11 the rule is called commandBlockOutput.

Things to know

Version references: 1.21.9 server-property changes and 1.21.11 game-rule names.