Trying to script partitioning Macintosh HD in command line?
Your main disk is already partitioned. You can't use diskutil partitionDisk /dev/disk0 GPT ... booted to the same disk.



In my opinion you have three options:


Resize the current Logical Volume "Macintosh HD" and create a second logical volume in the LVG
Resize the whole stack and add a fourth volume at the end
Create a growing sparsebundle image in your encrypted volume "Macintosh HD"





Resize the logical volume:


resize the logical volume:

diskutil cs resizeVolume EFDB0B2F-EEBB-4CAC-8AFE-69F4C1803A54 399055m

add a second logical volume in the free LVG space:

diskutil cs createVolume 5E012656-B5D2-43E3-999F-5EF2E2D0C138 jhfsx "dev" 100%

Result:

/dev/disk0 (internal, physical):
  #:                       TYPE NAME                    SIZE           IDENTIFIER
  0:      GUID_partition_scheme                        *500.3 GB       disk0
  1:                        EFI EFI                     209.7 MB       disk0s1
  2:          Apple_CoreStorage Macintosh HD            499.4 GB       disk0s2
  3:                 Apple_Boot Recovery HD             650.0 MB       disk0s3

/dev/disk1 (internal, virtual):
  #:                       TYPE NAME                    SIZE           IDENTIFIER
  0:                  Apple_HFS Macintosh HD           +399.1 GB       disk1
                         Logical Volume on disk0s2
                         EFDB0B2F-EEBB-4CAC-8AFE-69F4C1803A5
                         Unlocked Encrypted
/dev/disk2 (internal, virtual):
  #:                       TYPE NAME                    SIZE           IDENTIFIER
  0:                  Apple_HFS dev                     100.0 GB       disk2
                         Logical Volume on disk0s2
                         C7C75FC4-4062-42E7-B2F5-576CFCA257854
                         Unencrypted


Resize the stack:


resize the whole stack:

diskutil cs resizeStack EFDB0B2F-EEBB-4CAC-8AFE-69F4C1803A54 399055m

add a fourth volume with gdisk (download required)

sudo gdisk /dev/disk0

Enter the following key sequence: N/Enter/Enter/Enter/AF00/W/Y Check the help with `?`!

format case-sensitive after getting the new device identifier

diskutil list
sudo newfs_hfs -v dev -J -s disk0s4 #use the appropriate device identifier here

modify volume permissions with chgrp/chmod if necessary
Result:

/dev/disk0 (internal, physical):
  #:                       TYPE NAME                    SIZE           IDENTIFIER
  0:      GUID_partition_scheme                        *500.3 GB       disk0
  1:                        EFI EFI                     209.7 MB       disk0s1
  2:          Apple_CoreStorage Macintosh HD            399.4 GB       disk0s2
  3:                 Apple_Boot Recovery HD             650.0 MB       disk0s3
  4:                  Apple_HFS dev                     100.0 GB       disk0s4        
/dev/disk1 (internal, virtual):
  #:                       TYPE NAME                    SIZE           IDENTIFIER
  0:                  Apple_HFS Macintosh HD           +399.1 GB       disk1
                         Logical Volume on disk0s2
                         EFDB0B2F-EEBB-4CAC-8AFE-69F4C1803A5
                         Unlocked Encrypted


Create a growing sparsebundle:

hdiutil create -type SPARSEBUNDLE -size 100g -fs JHFS+X -volname dev dev


Check man hdiutil for other formats like SPARSE etc.




Scripting this is rather difficult but not impossible - except the last proposal which is easy to implement.